错误:sigjmp_buf没有命名类型。使用Poco C ++库编译我的项目时

问题描述 投票:-1回答:1

我正在Windows10_x86_64下从事C ++项目。我正在使用通过Msys2安装的Poco C ++库用于MinGW64编译器。使用Msys2成功安装了我所有项目的依赖项。

但是,当我尝试编译我的项目时,出现下一个错误:

In file included from /mingw64/include/Poco/Thread_POSIX.h:23,
             from /mingw64/include/Poco/Thread.h:35,
             from /mingw64/include/Poco/ThreadPool.h:22,
             from /mingw64/include/Poco/ActiveStarter.h:22,
             from /mingw64/include/Poco/ActiveMethod.h:24,
             from /mingw64/include/Poco/AbstractEvent.h:25,
             from /mingw64/include/Poco/BasicEvent.h:21,
             from /mingw64/include/Poco/Util/AbstractConfiguration.h:25,
             from /mingw64/include/Poco/Util/LoggingConfigurator.h:24,
             from ../../prompt/common/PLogger.h:41,
             from PLogger.cpp:15:
/mingw64/include/Poco/SignalHandler.h:80:2: error: 'sigjmp_buf' does not name a type; did you mean 'jmp_buf'?
   80 |  sigjmp_buf& jumpBuffer();
      |  ^~~~~~~~~~
      |  jmp_buf
/mingw64/include/Poco/SignalHandler.h:99:3: error: 'sigjmp_buf' does not name a type; did you mean 'jmp_buf'?
   99 |   sigjmp_buf buf;
      |   ^~~~~~~~~~
      |   jmp_buf

查看SignalHandler.h之后,我看到此文件包括:

#include <setjmp.h>

并且该文件包括:

#include <machine/setjmp.h>

定义sigjmp_buf:

/* POSIX sigsetjmp/siglongjmp macros */
#ifdef _JBTYPE
typedef _JBTYPE sigjmp_buf[_JBLEN+1+((sizeof (_JBTYPE) + sizeof (sigset_t) - 1)
                     /sizeof (_JBTYPE))];
#else
typedef int sigjmp_buf[_JBLEN+1+(sizeof (sigset_t)/sizeof (int))];
#endif

我包括:

-Ic:/ msys64 / usr / include对于setjmp.h和machine / setjmp.h和

-Ic:/ msys64 / mingw64 / include对于Poco标头

进入我的Makefile,但错误仍然存​​在。

我不知道错误在哪里。预先感谢。

c++ compiler-errors mingw-w64 poco-libraries msys2
1个回答
0
投票

要编译项目文件,我使用了如下语句:

g++ -o ../../../../target/build/debug/PLogger.o PLogger.cpp -I../../ -std=c++14 -Werror -pedantic -Wall -Wformat -Winline -Wunused -g -D_DEBUG -DPCOM_EXPORTS -fpic -c

并且我解决此错误,删除:-std = c ++ 14选项。但是我遇到了一个新的错误:

relocation truncated to fit: R_X86_64_PC32 against undefined symbol

WTF?

正如我在使用Msys2将项目移植到MS Windows之前所说(我对Msys2的第一次体验)。我开始手动安装每个软件包:gcc,gdb,make,boost,poco等

我的最终解决方案(已解决问题)是卸载Msys2,从我的计算机上删除所有文件。重新安装它,然后首先:

$ pacman -Syu
$ pacman -Su
$ pacman -S mingw-w64-x86_64-toolchain    -> instead of install manually gcc
...
$ pacman -S mingw-w64-x86_64-poco
$ pacman -S git

现在一切正常。感谢@CookieButter的评论。

© www.soinside.com 2019 - 2024. All rights reserved.