How to compile boost async_client.cpp

前端 未结 1 379
天涯浪人
天涯浪人 2020-12-04 02:47

What is the correct command to compile this code? http://www.boost.org/doc/libs/1_45_0/doc/html/boost_asio/example/http/client/async_client.cpp I had installed boost library

相关标签:
1条回答
  • 2020-12-04 03:30

    E.g.

    clang++ -std=c++03 -Wall -pedantic -g -O2 async_client.cpp -o async_client -lboost_system -lboost_thread -lpthread
    

    Assuming your system's packaged version of Boost (or pre-configured include & lib paths). To make use of your custom built Boost library tree in ~/custom/boost:

    clang++ -std=c++03 -Wall -pedantic -g -O2 \
         -isystem ~/custom/boost/ ~/custom/boost/libs/asio/example/cpp03/http/client/ \
         async_client.cpp -o async_client \
         -L ~/custom/boost/stage/lib/ -Wl,-rpath,/home/sehe/custom/boost/stage/lib \
         -lboost_system -lboost_thread -lpthread
    

    Replace clang++ by g++ at will.

    -std=c++03 -Wall -pedantic -g -O2 only for expositional purposes.

    0 讨论(0)
提交回复
热议问题