2013-07-03 34 views
5

我正在编译和使用Boost 1.54库并已运行到一个deadend。对Boost线程的未定义引用

我编译和安装库,如文档中提到:

./bootstrap.sh 
./b2 install 

我甚至尝试使用一个完整的重新安装:

./bootstrap.sh 
./b2 threading=multi install 

我已经联系使用-lboost_thread-L*path提高* /箱.v2/libs

我仍然收到以下链接器错误:

undefined reference to boost::thread::start_thread_noexcept() 
undefined reference to boost::thread::join_noexcept() 

我在Eclipse的Ubuntu 12.04上使用gcc 4.6.3。

有谁知道我该如何解决这个问题?

+0

什么'-lboost_system'? –

+0

它也被链接,因为我也使用asio。 – Zippo

+0

你可以显示你的实际链接器调用? –

回答

3

相当多的痛苦与Ubuntu软件仓库默认升压后,我使用默认选项安装升压1.54.0(从官方网页),和我下面的工作:

g++ test.cpp -o test -L/usr/local/lib/ -lboost_thread 

PS :在Ubuntu 12.04上,gcc 4.63

P.S2:包括在我test.cpp是:

#include "boost/thread/thread.hpp" 
#include "boost/bind.hpp" 
相关问题