在ubuntu 14.04上使用boost编译:未定义引用`boost :: thread :: get_id()const'

时间:2015-02-07 02:38:22

标签: c++ multithreading ubuntu boost

我正在尝试编译一个简单的boost程序,该程序在ubuntu 14.04上使用线程(使用boost 1.54)。

汇编的输出如下:

09:30:25 **** Incremental Build of configuration Debug for project sdkTest ****
make all 
Building target: sdkTest
Invoking: GCC C++ Linker
g++ -L"/home/khan/git/sdkLinux/libFingiSdk/Debug" -o "sdkTest"  ./src/CommunicationCoreTest.o ./src/CoreTest.o ./src/LoggerTest.o ./src/ProgramOptions.o ./src/sdkTest.o   -lfingidevicesdk -lz -lssl -lcurl -lpthread -lboost_system -lboost_regex -lboost_signals -lboost_thread -lboost_chrono -lboost_program_options -lboost_filesystem -lboost_iostreams -lboost_unit_test_framework -lpython2.7 -lboost_python
/home/khan/git/sdkLinux/libFingiSdk/Debug/libfingidevicesdk.so: undefined reference to `boost::thread::get_id() const'
/home/khan/git/sdkLinux/libFingiSdk/Debug/libfingidevicesdk.so: undefined reference to `boost::filesystem3::detail::status(boost::filesystem3::path const&, boost::system::error_code*)'
/home/khan/git/sdkLinux/libFingiSdk/Debug/libfingidevicesdk.so: undefined reference to `boost::thread::join()'
collect2: error: ld returned 1 exit status
make: *** [sdkTest] Error 1

09:30:25 Build Finished (took 413ms)

我使用

安装了增强功能
sudo apt-get install libboost-all-dev

在编译中我添加了对libboost_thread,pthread等的引用。 (实际上这用于在ubuntu 12.10上编译正常,提升1.48)。

知道这里有什么不对吗?

1 个答案:

答案 0 :(得分:1)

/home/khan/git/sdkLinux/libFingiSdk/Debug/libfingidevicesdk.so: undefined reference to `boost::thread::get_id() const'

您还需要将libfingidevicesdk.so与boost线程库相关联。