本文介绍了错误:sigjmp_buf没有命名类型.使用Poco C ++库编译我的项目时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm working on a C++ project under Windows10_x86_64.I'm using Poco C++ libraries installed using Msys2 for a MinGW64 compiler.All my project's dependencies were installed successfully by using Msys2.

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

However when I'm trying to compile my project I got next error:

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之后,我看到此文件包括:

After reviewing SignalHandler.h I saw that this file includes:

#include <setjmp.h>

该文件包括:

#include <machine/setjmp.h>

定义sigjmp_buf:

which define 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/usr/include for setjmp.h and machine/setjmp.h and

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

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

into my Makefile, but the errors persists.

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

I don't understand where's the error.Thanks in advance.

推荐答案

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

To compile project files I used statements like:

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 选项.但是我遇到了一个新的错误:

And I resolve this error removing: -std=c++14 option. However I got a new error:

relocation truncated to fit: R_X86_64_PC32 against undefined symbol

WTF?

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

As I said before I'm using Msys2 to port this project to MS Windows (my first experience with Msys2). And I started installing every package manually:gcc, gdb, make, boost, poco, etc.

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

My final solution (PROBLEM RESOLVED) was uninstall Msys2 deleting all files from my computer. Reinstall it, and then firstly:

$ 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的评论.

Now everything is working fine.Thanks @CookieButter for your comment.

这篇关于错误:sigjmp_buf没有命名类型.使用Poco C ++库编译我的项目时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-09 10:41