编译此代码的正确命令是什么? http://www.boost.org/doc/libs/1_45_0/doc/html/boost_asio/example/http/client/async_client.cpp 我在/ usr / include / boost
中安装了boost库答案 0 :(得分:2)
E.g。
clang++ -std=c++03 -Wall -pedantic -g -O2 async_client.cpp -o async_client -lboost_system -lboost_thread -lpthread
假设您的系统是Boost的打包版本(或预先配置的包含& lib路径)。要在~/custom/boost
中使用自定义构建的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
clang++
随意替换g++
。
-std=c++03 -Wall -pedantic -g -O2
仅用于展示目的。