首页 文章

如何编译boost async_client.cpp

提问于
浏览
2

编译此代码的正确命令是什么? http://www.boost.org/doc/libs/1_45_0/doc/html/boost_asio/example/http/client/async_client.cpp我在/ usr / include / boost中安装了boost库

1 回答

  • 2

    例如 .

    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
    

    g++ 替换 clang++ .

    -std=c++03 -Wall -pedantic -g -O2 仅用于说明目的 .

相关问题