红联Linux门户
Linux帮助

undefined reference to `boost::system::generic_category()

发布时间:2017-01-06 15:23:29来源:linux网站作者:NearXDU
最近学习boost.asio,写了个简单的server.cpp编译出错:
undefined reference to `boost::system::generic_category()
环境:ubuntu14.04 g++4.8.4
解决办法
You should link in the libboost_system library. I am not sure about codeblocks, but the g++ command-line option on your platform would be
-lboost_system
 
附:同样是boost.asio中用到boost.thread处理I/O,编译出错:
undefined reference to `vtable for boost::detail::thread_data_base’
环境
ubuntu14.04
g++ 4.8.4
解决办法
I had the same question, but -lboost_thread-mt is now deprecated see this answer on askubuntu.com. Instead what you now want in your makefile (at least for Linux) is:
-lpthread -lboost_thread …
 
本文永久更新地址:http://www.linuxdiyf.com/linux/27580.html