Linker error when compiling boost.asio example

后端 未结 3 617
孤城傲影
孤城傲影 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:14

    You need to tell g++ where the header files are, where the libraries are and which library you are using, e.g. on my system:

    g++  -I /opt/local/include -L /opt/local/lib -lboost_system-mt -lboost_thread-mt a.cpp
    

    where -I tells g++ where the header files are and -L tells g++ where the actual libraries are and -lboost_thread-mt is the library I want to link against in the -L folder.

提交回复
热议问题