Linker error when compiling boost.asio example

后端 未结 3 621
孤城傲影
孤城傲影 2020-12-09 18:32

I\'m trying to learn a little bit C++ and Boost.Asio. I\'m trying to compile the following code example:

#include 
#include 

        
3条回答
  •  渐次进展
    2020-12-09 19:38

    you need to link against libboost_system and apparently also against libboost_thread.

    g++ -I /usr/local/boost_1_42_0 -lboost_system -lboost_thread a.cpp
    

    in case of multi-threaded libraries:

    g++ -I /usr/local/boost_1_42_0 -lboost_system-mt -lboost_thread-mt a.cpp
    

提交回复
热议问题