在Linux Ubuntu Server上提升11.10(VPS)使用ASIO编译C

boost on linux ubuntu server 11.10 (vps) compiling with C++ using asio

本文关键字:VPS 使用 ASIO 编译 Ubuntu Linux Server      更新时间:2023-10-16

我遵循了UNIX的指南。http://www.boost.org/doc/libs/1_51_0/more/getting_started/unix-variants.html。它在我的Mac上正常工作。但是在我的VPS上,我似乎遇到了一些问题。我下载了最新的构建,并运行了bootstrap和b2 install和示例。cpp工作正常。

当我疲倦地编译UDP ECHO服务器时-http://www.boost.org/doc/libs/1_38_0/doc/doc/html/boost_asio/echo/echo/echo/echo/ashync_udp_echo_server.cpp

我有以下错误。

andrew@am:~/Documents/boostExamples/asyncUdpEchoServer$ c++ -I /usr/local/boost main.cpp -o udpEchoServer
/tmp/cczYAR1r.o: In function `__static_initialization_and_destruction_0(int, int)':
main.cpp:(.text+0x21e): undefined reference to `boost::system::generic_category()'
main.cpp:(.text+0x228): undefined reference to `boost::system::generic_category()'
main.cpp:(.text+0x232): undefined reference to `boost::system::system_category()'
/tmp/cczYAR1r.o: In function `boost::system::error_code::error_code()':
main.cpp:(.text._ZN5boost6system10error_codeC2Ev[_ZN5boost6system10error_codeC5Ev]+0x10): undefined reference to `boost::system::system_category()'
/tmp/cczYAR1r.o: In function `boost::asio::error::get_system_category()':
main.cpp:(.text._ZN5boost4asio5error19get_system_categoryEv[boost::asio::error::get_system_category()]+0x7): undefined reference to `boost::system::system_category()'
collect2: ld returned 1 exit status

有什么想法我需要在这里做什么? - 如果您不需要建立增压的影响,我很方便。

VPS正在运行Ubuntu Server 11.10,但似乎有点降低。我已经安装了建筑物。

您必须链接boostrongystem lib: -lboost_system。也不要忘记在需要时指定lib目录。