一、下载boost最新版本的库: https://www.boost.org/
二、解压到 D:\boost
三、打开Visual Studio的控制台,即【开始】-【所有程序】-【Visual Studio X xxxx】-【xxxxx】
vs安装时不会为库,头文件配置环境变量,用Windows CMD会导致"no such file or directory ‘cstddef’"等错误
四、设置工作目录 cd /d D:\boost\boost_1_69_0 (各人版本不同)
五、输入 bootstrap.bat 生成boost编译相关文件
编译成功后在 D:\boost\boost_1_69_0 下生成bajm.exe,b2.exe,我们用最新版的b2.exe
六、输入 b2.exe stage --build-dir=".\temp" --build-type=complete threading=multi link=static runtime-link=shared --toolset=msvc-14.1 等待编译结束
命令行含义及选项如下 (执行 .\b2 --help 会有相关命令行介绍) :
-
stage: 只生成库; 可选install,同时生成库和头文件
-
–stagedir="[stage folder name]": 存放编译后库文件的路径,默认路径是./stage
-
–build-dir="[tempor