如何编译 boost async_client.cpp [英] How to compile boost async_client.cpp

查看:25
本文介绍了如何编译 boost async_client.cpp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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 in /usr/include/boost

推荐答案

例如

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

假设您的系统是 Boost 的打包版本(或预配置的包含和 lib 路径).要在 ~/custom/boost 中使用自定义构建的 Boost 库树:

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

随意用g++替换clang++.

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

这篇关于如何编译 boost async_client.cpp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆