c + +升压:未定义的引用,以提高::系统:: generic_category() [英] C++ Boost: undefined reference to boost::system::generic_category()

查看:1523
本文介绍了c + +升压:未定义的引用,以提高::系统:: generic_category()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在自己的项目加速库,并已面临着同样的问题。我在Ubuntu 12.10与$ C $个cblocks IDE,并试图​​安装手动读取从站点的指令库,但渐渐的错误与头以及待内置之前使用的库。

我然后通过terminalby sudo的安装库的apt-get安装的libboost-ALL-dev的。在此之后,在我的$ C $个cblocks节目,我可以包括像头的#include<升压/ regex.hpp> 但是当我尝试以包括头文件系统库(的#include助推/文件系统/ operations.hpp),我收到以下错误:

  /usr/include/boost/system/error_$c$c.hpp|214|undefined参考提振::系统:: generic_category()|

我不知道如何解决这个错误(特别是在Linux上的$ C $个cblocks)。我真的在这里可以使用一些帮助。

编译器:GCC

计划code:只有试过计有上述文件系统 operations.hpp 文件

从$ C $个cblocks生成日志:

 生成开始:20-11-2012 18:02.53
截至建立在:20-11-2012 18:02.54
--------------构建:调试中libopenFrameworks ---------------
目标是最新的。
--------------构建:调试中reader1 ---------------
让-s -f Makefile的调试
连接的i686斌/ reader1_debug的Linux
OBJ / i686Debug / src目录/ testApp.o:在功能`__static_initialization_and_destruction_0:
/usr/include/boost/system/error_$c$c.hpp:214:未定义的引用`的boost ::系统:: generic_category()
/usr/include/boost/system/error_$c$c.hpp:215:未定义的引用`的boost ::系统:: generic_category()
/usr/include/boost/system/error_$c$c.hpp:216:未定义的引用`的boost ::系统:: system_category()
OBJ / i686Debug / src目录/ main.o中:在功能`__static_initialization_and_destruction_0:
/usr/include/boost/system/error_$c$c.hpp:214:未定义的引用`的boost ::系统:: generic_category()
/usr/include/boost/system/error_$c$c.hpp:215:未定义的引用`的boost ::系统:: generic_category()
/usr/include/boost/system/error_$c$c.hpp:216:未定义的引用`的boost ::系统:: system_category()
collect2:劳工处返回1退出状态
使:*** [斌/ reader1_debug]错误1
流程终止状态2(0分钟,1秒为单位)
6个错误,0警告


解决方案

您应该在 libboost_system 库链接。我不知道$ C $个cblocks,但你的平台上g ++命令行选项是


  

-lboost_system


I am trying to include Boost libraries in my project and have been facing issues in the same. I am on Ubuntu 12.10 with Codeblocks IDE and tried installing the libraries manually reading instructions from the site, but was getting error's with header as well as to-be-built-before-use libraries.

I then installed the libraries via terminalby sudo apt-get install libboost-all-dev. After this, in my programs on Codeblocks, I can include headers like #include <boost/regex.hpp> but when I try to include the header for the Filesystem library ( #include "boost/filesystem/operations.hpp" ), I am getting the following error:

/usr/include/boost/system/error_code.hpp|214|undefined reference to boost::system::generic_category()'|

I am not sure how to resolve this error (specifically in Codeblocks on Linux). I really could use some help here.

Compiler : Gcc
Program code: Only tried inlcuding the above file system operations.hpp file.

Build log from Codeblocks:

Build started on: 20-11-2012 at 18:02.53
Build ended on: 20-11-2012 at 18:02.54
-------------- Build: Debug in libopenFrameworks ---------------
Target is up to date.
-------------- Build: Debug in reader1 ---------------
make -s -f Makefile Debug
linking i686 bin/reader1_debug linux
obj/i686Debug/src/testApp.o: In function `__static_initialization_and_destruction_0':
/usr/include/boost/system/error_code.hpp:214: undefined reference to `boost::system::generic_category()'
/usr/include/boost/system/error_code.hpp:215: undefined reference to `boost::system::generic_category()'
/usr/include/boost/system/error_code.hpp:216: undefined reference to `boost::system::system_category()'
obj/i686Debug/src/main.o: In function `__static_initialization_and_destruction_0':
/usr/include/boost/system/error_code.hpp:214: undefined reference to `boost::system::generic_category()'
/usr/include/boost/system/error_code.hpp:215: undefined reference to `boost::system::generic_category()'
/usr/include/boost/system/error_code.hpp:216: undefined reference to `boost::system::system_category()'
collect2: ld returned 1 exit status
make: *** [bin/reader1_debug] Error 1
Process terminated with status 2 (0 minutes, 1 seconds)
6 errors, 0 warnings

解决方案

You should link in the libboost_system library. I am not sure about codeblocks, but the g++ command-line option on your platform would be

-lboost_system

这篇关于c + +升压:未定义的引用,以提高::系统:: generic_category()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆