- 在尝试使用boost库1.71.0的过程中,遇到了bootstrap.bat运行失败的问题,在查找网上的解决方法并做了尝试之后,未能解决,自己摸索尝试了一下,才解决此问题,浪费了一些时间,记录一下,也供他人参考。
bootstrap.log显示如下信息:
解决方法
- 找到vs2013的命令工具
- 使用vs2013 x64本机工具命令提示,想要编译库为64的应选用64位的命令提示。
- 找到bootstrap.bat 所在文件夹,输入bootstrap.bat msvc
D:\软件安装包\boost_1_71_0\boost_1_71_0>bootstrap.bat msvc
Building Boost.Build engine
Generating Boost.Build configuration in project-config.jam for msvc...
Bootstrapping is done. To build, run:
.\b2
To adjust configuration, edit 'project-config.jam'.
Further information:
- Command line help:
.\b2 --help
- Getting started guide:
http://boost.org/more/getting_started/windows.html
- Boost.Build documentation:
http://www.boost.org/build/
- 运行编译生成的b2文件,可参考:https://www.cnblogs.com/sanghg/p/5475044.html,不过需要将bjam替换为b2,要生成64位的boost库,还需添加address-model=64,可参考如下指令:
b2 stage --toolset=msvc-12.0 address-model=64 --without-python --without-test --without-wave --without-graph --without-serialization --stagedir="D:\boost_1_71_0\bin\vc12" link=static runtime-link=shared runtime-link=static threading=multi debug release
至此boost库编译完成,将boost文件夹以及在指定目录生成的lib文件夹添加到项目的包含目录与库目录中即可使用。
疑问
boost文件夹有100多M,如果部分添加其中的文件,会编译报错,目前只得全部添加。