别人写的编译参考:python
目标:使用VS2015 编译 64位的boost库。bootstrap
一直以来都是在Win32环境下Build和使用boost,但如今基本上天天都在64位Win7下工做,因此颇有必要把这几天的经验总结下来。工具
1. 下载并解压boost 1.61.0 压缩包ui
2. 解压并运行批处理文件bootstrap.bat,目录下会生成两个可执行文件命令行
3. 和32位环境不一样,x64环境下编译得先从开始菜单启动Visual Studio的VS2015 x64 Native Tools Command Prompt 进入命令提示符,而不是随便打开任意一个命令行窗口就行。debug
4. 而后cd到boost根文件夹,运行bootstrap.bat生成x64版的b2.exe 和 bjam.exe (他们只是版本不一样的产物,可是用法一致,bjam是以前版本的,b2 是最新的)编译器
5. 而后运行命令: it
b2 --build-type=complete toolset=msvc-14.0 threading=multi link=shared address-model=64 io
便可生成DLL版平台库,若是要编译静态库版就把shared改成static。编译
个人过程以下:
1.下载1.63.0版本的boost库,放置D:\boost_1_63_0
2.编译64位的boost须要在VC 提供的命令提示符进行操做。
3.开始转到boost根目录,运行bootstrap.Bat生成X64版本的bjam.exe和b2。
4.
B2是新版,而后运行命令:64位静态库
b2 stage --toolset=msvc-14.0 --without-graph --without-graph_parallel --stagedir="d:\boost_1_63_0\lib64-msvc-14" address-model=64 link=static runtime-link=static threading=multi debug release
64位的动态库
b2 stage --toolset=msvc-14.0 --without-graph --without-graph_parallel --stagedir="d:\boost_1_63_0\lib64-msvc-14" address-model=64 link=static runtime-link=shared threading=multi debug release
我是用的是:
b2 stage --toolset=msvc-14.0 --without-graph --without-graph_parallel --stagedir="d:\boost_1_63_0\lib64-msvc-14" address-model=64 link=shared threading=multi
b2 stage --toolset=msvc-14.0 --without-graph --without-graph_parallel --stagedir="d:\boost_1_63_0\lib64-msvc-14" address-model=64 link=static threading=multi
5.须要注意的是address-model=64属性,若是没有这个属性的话,会默认生成32位的平台库,加入这个选项才能生成64位的DLL。
要编译好久
而后可使用了。
6.使用方法:
设置下环境变量,头文件路径BOOST64_BASE_DIR , BOOST64_LIB_DIR.
2017/8/28
再次编译系统,在visual studio 2010下编译boost库:
使用VS2010 64位工具,切换到boost目录,键入命令:
b2 stage --toolset=msvc-10.0 --stagedir="d:\boost_1_63_0\lib64-msvc-10" address-model=64
选择全编译,知名库的编译路径,编译器工具,虽然时间长,不会有缺库的提示。