【发布时间】:2014-01-07 03:24:37
【问题描述】:
我在 fedora xfce 上运行了一个简单的 boost asio 示例……它给出了这些错误……知道吗?
#include <boost/asio.hpp>
#include <iostream>
int main( int argc, char * argv[] )
{
boost::asio::io_service io_service;
io_service.run();
std::cout << "Do you reckon this line displays?" << std::endl;
return 0;
}
输出:
obj/Debug/main.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|undefined reference to `boost::system::system_category()'|
obj/Debug/main.o||In function `boost::system::error_code::error_code()':|
/usr/include/boost/system/error_code.hpp|315|undefined reference to `boost::system::system_category()'|
obj/Debug/main.o||In function `boost::asio::error::get_system_category()':|
/usr/include/boost/asio/error.hpp|216|undefined reference to `boost::system::system_category()'|
||=== Build finished: 5 errors, 0 warnings (0 minutes, 1 seconds) ===|
【问题讨论】:
-
无论如何,我使用 Boost 1.49 在 Windows 8 下按原样编译并链接了您的测试程序,没有编译错误。所以至少你知道你的程序没有任何有机错误。
标签: c++ boost boost-asio