【问题标题】:How to compile boost async_client.cpp如何编译 boost async_client.cpp
【发布时间】:2014-03-10 22:24:58
【问题描述】:

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

【问题讨论】:

  • 请在问题中包含任何相关代码,而不是发布链接。

标签: boost


【解决方案1】:

例如

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

假设您系统的 Boost 打包版本(或预配置的包含和库路径)。要在~/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 仅用于说明目的。

【讨论】:

    猜你喜欢
    • 2022-07-15
    • 2012-05-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-11-29
    相关资源
    最近更新 更多