boost 1.67编译VS2017版本

最近想系统学习并使用一下boost的asio异步网络库,所以需要编译boost库使用,下面简单介绍如何编译。

 

编译环境

boost1.67版本,windows 10,VS2017

 

下载boost

建议到官网去下载,目前最新的是1.67版本,链接:https://dl.bintray.com/boostorg/release/1.67.0/source/,会提供很多压缩方式的压缩包,我选择了zip版本的。

 

解压

把压缩包boost_1_67_0.zip解压到当前目录,得到boost_1_67_0目录。

 

编译

直接进入boost_1_67_0目录,双击运行脚本bootstrap.bat,编译boost编译引擎(Building Boost.Build engine)。等待几分钟,就会编译出b2.exe和bjam.exe,这小步骤就表示成功了。

新建一个build_vs2017.bat脚本文件,输入如下内容:

@ECHO OFF

ECHO Building Boost lib, vs2017

bjam.exe install --prefix="boost_1_67_vs2017" --toolset=msvc-14.1  link=static runtime-link=shared threading=multi debug release

 

执行程序bjam.exe,后面的参数可执行bjam.exe --help来了解具体内容

install                        Install headers and compiled library files to the configured locations (below).

--prefix=<PREFIX>   Install architecture independent files here.Default; C:\Boost on Win32; Default; /usr/local on Unix. Linux, etc.

toolset=toolset         Indicate the toolset to build with.

link=static|shared     Whether to build static or shared libraries

runtime-link=static|shared Whether to link to static or shared C and C++ runtime.

threading=single|multi  Whether to build single or multithreaded binaries

 

等待10多分钟,即可看到当前目录下有一个目录boost_1_67_vs2017,里面则是编译出来的库,其中还包括头文件。里面的库比较多,为了方便引用具体的库,可参考库的命名规范:

http://www.cppblog.com/Robertxiao/archive/2013/01/06/197022.html

 

总结

总体来说,boost编译还是比较简单的,或者说官方提供了比较友好的编译方式,为广大的使用者减少负担,点赞。

 

转载于:https://www.cnblogs.com/qinwanlin/p/boost.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值