2012-09-05 63 views
1

我在其他项目中使用了很多boost的部分。我想尝试升压asio,但我在第一步失败。给定最小的代码。 。第一次尝试使用boost :: asio时出现错误

#include <boost/asio.hpp> 

int main() 
{ 
    return 0; 
} 

和编译在Mac上使用

clear; g++ client.cpp -I/path_to_boost/ -o clientapp

我得到的错误

Undefined symbols for architecture x86_64:
"boost::system::system_category()", referenced from: __static_initialization_and_destruction_0(int, int)in ccLQRfXY.o boost::asio::error::get_system_category() in ccLQRfXY.o boost::system::error_code::error_code()in ccLQRfXY.o "boost::system::generic_category()", referenced from: __static_initialization_and_destruction_0(int, int)in ccLQRfXY.o ld: symbol(s) not found for architecture x86_64 collect2: ld returned 1 exit status

回答

1

Boost.Asio的取决于Boost.System,所以你也应该链接libboost_system。

相关问题