boost.asio编译有错啊! tcp_async_echo_client.cpp:(.text+0x1f2):对‘boost::system::generic_category()’未定义的引用

2019.08.13

 

# [error_01]
# tcp_async_echo_client.cpp:88:83: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
# tcp_async_echo_client.cpp:88:83: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
# /tmp/cc879aYR.o:在函数‘__static_initialization_and_destruction_0(int, int)’中:
# tcp_async_echo_client.cpp:(.text+0x1f2):对‘boost::system::generic_category()’未定义的引用
# tcp_async_echo_client.cpp:(.text+0x1fe):对‘boost::system::generic_category()’未定义的引用
# tcp_async_echo_client.cpp:(.text+0x20a):对‘boost::system::system_category()’未定义的引用
# /tmp/cc879aYR.o:在函数‘boost::system::error_code::error_code()’中:
# tcp_async_echo_client.cpp:(.text._ZN5boost6system10error_codeC2Ev[_ZN5boost6system10error_codeC5Ev]+0x17):对‘boost::system::system_category()’未定义的引用
# /tmp/cc879aYR.o:在函数‘boost::this_thread::sleep(boost::posix_time::ptime const&)’中:
# tcp_async_echo_client.cpp:(.text._ZN5boost11this_thread5sleepERKNS_10posix_time5ptimeE[_ZN5boost11this_thread5sleepERKNS_10posix_time5ptimeE]+0x28):对‘boost::this_thread::hiden::sleep_until(timespec const&)’未定义的引用
# /tmp/cc879aYR.o:在函数‘boost::asio::error::get_system_category()’中:
# tcp_async_echo_client.cpp:(.text._ZN5boost4asio5error19get_system_categoryEv[_ZN5boost4asio5error19get_system_categoryEv]+0x5):对‘boost::system::system_category()’未定义的引用
# collect2: error: ld returned 1 exit status
# 解决:
# 第一步:
#   g++ \
#       -o  server  server.cpp \
#       -L/usr/lib/x86_64-linux-gnu \
#       -lboost_system -lboost_filesystem -lboost_thread  \
#       -pthread \
# 第二步:
#   装了sudo apt-get install libasio-dev
#   还要装这个sudo apt-get install libboost-all-dev

 

 

 

你可能感兴趣的:(boost.asio编译有错啊! tcp_async_echo_client.cpp:(.text+0x1f2):对‘boost::system::generic_category()’未定义的引用)