伙计们!
我正在使用ubuntu 12.04
并尝试编译一个boost
测试程序。我安装了升压
sudo apt-get install libboost-all-dev
所以,我不知道在哪里可以找到我的图书馆。我尝试使用
g++ -lboost_system -lboost_thread boost_test.cpp
想也许有一些默认路径,其中 ubuntu 自动安装了 boost,但这是错误的,我有以下内容:
/tmp/ccTKXzTR.o: 在函数
__static_initialization_and_destruction_0(int, int)': boost_test.cpp:(.text+0xcc): undefined reference to
boost::system::generic_category()' boost_test.cpp:(.text+0xd8): undefined reference toboost::system::generic_category()' boost_test.cpp:(.text+0xe4): undefined reference to
boost::system::system_category()' /tmp/ccTKXzTR.o:在函数boost::system::error_code::error_code()': boost_test.cpp:(.text._ZN5boost6system10error_codeC2Ev[_ZN5boost6system10error_codeC5Ev]+0x17): undefined reference to
boost::system::system_category()' /tmp/ccTKXzTR.o: 在函数boost::asio::error::get_system_category()': boost_test.cpp:(.text._ZN5boost4asio5error19get_system_categoryEv[_ZN5boost4asio5error19get_system_categoryEv]+0x5): undefined reference to
boost::system::system_category()' /tmp/ccTKXzTR.o: 在函数boost::asio::detail::posix_tss_ptr_create(unsigned int&)': boost_test.cpp:(.text._ZN5boost4asio6detail20posix_tss_ptr_createERj[_ZN5boost4asio6detail20posix_tss_ptr_createERj]+0x19): undefined reference to
pthread_key_create' /tmp/ccTKXzTR.o: 在函数boost::asio::detail::posix_tss_ptr<boost::asio::detail::call_stack<boost::asio::detail::task_io_service, boost::asio::detail::task_io_service::thread_info>::context>::~posix_tss_ptr()': boost_test.cpp:(.text._ZN5boost4asio6detail13posix_tss_ptrINS1_10call_stackINS1_15task_io_serviceENS4_11thread_infoEE7contextEED2Ev[_ZN5boost4asio6detail13posix_tss_ptrINS1_10call_stackINS1_15task_io_serviceENS4_11thread_infoEE7contextEED5Ev]+0x15): undefined reference to
pthread_key_delete'/tmp/ccTKXzTR.o:在函数boost::asio::detail::posix_tss_ptr<boost::asio::detail::call_stack<boost::asio::detail::strand_service::strand_impl, unsigned char>::context>::~posix_tss_ptr()': boost_test.cpp:(.text._ZN5boost4asio6detail13posix_tss_ptrINS1_10call_stackINS1_14strand_service11strand_implEhE7contextEED2Ev[_ZN5boost4asio6detail13posix_tss_ptrINS1_10call_stackINS1_14strand_service11strand_implEhE7contextEED5Ev]+0x15): undefined reference to
pthread_key_delete'collect2:错误:ld 返回 1 退出状态
有人可以帮我弄清楚我的库是否正确安装并编译吗?