环境介绍: win8rp vs2012 sql2012
1.去www.boost.org下载最新的boost,我下载了boost_1_49_0
2.我放在G:\WorkStation\boost_1_49_0
3.打开cmd 进入 C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin 找到vcvars32.bat 执行 vcvars32.bat
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin>vcvars32.bat
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin> g:
4. G:\>cd G:\WorkStation\boost_1_49_0\tools\build\v2
5.输入bootstrap,便生成bjam.exe文件 复制文件到boost根目录下
6. 输入bjam toolset=msvc-11.0 threading=multi link=static(我是vs2012 所以版本 是11.0)进行编译
7.设置环境 右击你的项目 选择属性--〉vc++目录
包含目录 设置:G:\WorkStation\boost_1_49_0
库目录 设置:G:\WorkStation\boost_1_49_0\stage\lib
查看需要编译的库
bjam --show-libraries
使用 VS 编译 32 位 boost
bjam --toolset=msvc
使用 VS 编译 64 位 boost
bjam --toolset=msvc address-model=64
仅编译指定的库
bjam --with-<libname>
排除指定的库
bjam --without-<libname>
编译所有的库类型(LIB库,DLL 库)
bjam --build-type=complete
单线程
bjam threading=single
多线程(只有 VC6 才能生成单线程的了,新的 boost 库都已经不支持 VC6)
bjam threading=multi
静态链接外部库
bjam runtime-link=static
动态链接外部库
bjam runtime-link=shared
只生成 DLL
bjam link=shared
只生成 LIB
bjam link=static
生成 debug 版本
bjam debug
生成 release 版本
bjam release
需要 LIB 的编译选项:
bjam --toolset=msvc threading=multi link=static runtime-link=shared runtime-link=static
需要 DLL 的编译选项:
bjam --toolset=msvc threading=multi link=shared runtime-link=shared runtime-link=static