我试图Boost在我的项目中包含库,并且一直面临着相同的问题.我在使用Codeblocks IDE的Ubuntu 12.10上,尝试手动从站点读取指令来安装库,但是在使用头文件以及使用前构建的库时出现了错误.
然后我通过terminalby安装了库sudo apt-get install libboost-all-dev.在此之后,在我的Codeblocks程序中,我可以包含标题,#include <boost/regex.hpp>但是当我尝试包含Filesystem库(#include "boost/filesystem/operations.hpp" )的标题时,我收到以下错误:
/usr/include/boost/system/error_code.hpp|214|undefined reference to boost::system::generic_category()'|
Run Code Online (Sandbox Code Playgroud)
我不知道如何解决此错误(特别是在Linux上的Codeblocks中).我真的可以在这里使用一些帮助.
编译器:Gcc
程序代码:仅尝试包含上述文件系统operations.hpp文件.
从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: …Run Code Online (Sandbox Code Playgroud)