我正在尝试包括Boost
我的项目中的图书馆也面临着同样的问题。我使用的是带有 Codeblocks IDE 的 Ubuntu 12.10,并尝试从站点读取说明手动安装库,但在标头以及使用前构建的库中出现错误。
然后我通过终端安装了库sudo apt-get install libboost-all-dev
。之后,在我的 Codeblocks 程序中,我可以包含像#include <boost/regex.hpp>
但是当我尝试包含文件系统库的标头时(#include "boost/filesystem/operations.hpp"
),我收到以下错误:
/usr/include/boost/system/error_code.hpp|214|undefined reference to boost::system::generic_category()'|
我不确定如何解决此错误(特别是在 Linux 上的 Codeblocks 中)。我真的需要一些帮助。
编译器:Gcc
程序代码:仅尝试包含上述文件系统operations.hpp
file.
来自代码块的构建日志:
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
您应该链接到libboost_system
图书馆。我不确定代码块,但您平台上的 g++ 命令行选项是
-lboost_系统
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)