Windows 编译Boost

(1)Boost 下载可以到官方网站下载:
http://www.boost.org/
(2)解压到一个文件夹
(3)编译:


1.打开命令提示窗口
低于1_45版本
2.进入D:/05_Computer/04_3rdPatry/02Boost/boost_1_44_0/boost_1_44_0/tools/jam/src
3.执行 build.bat 会在D:/05_Computer/04_3rdPatry/02Boost/boost_1_44_0/boost_1_44_0/tools/jam/src/bin.ntx86 生成 bjam.exe文件.
4.Copy bjam.exe 文件到 D:/05_Computer/04_3rdPatry/02Boost/boost_1_44_0/boost_1_44_0 下
5.进入D:/05_Computer/04_3rdPatry/02Boost/boost_1_44_0/boost_1_44_0 目录
6.执行bjam.exe 编译命令


高于1_45版本
1.进入$(boostDir)/boost_1_55_0 目录
2.执行bootstrap.bat
3.执行bjam.exe 编译命令,如下:
  
(1)编译所有boost动态库 (release|debug),包括头文件和库文件
bjam --toolset=msvc-8.0 --prefix=c:/boost_1_55_0/output --without-python --build-type=complete  link=shared  threading=multi install


bjam --toolset=msvc-11.0 --prefix=c:/boost/vs2012 --without-python --build-type=complete link=static threading=multi install


(2)只编译 release 版本 regex 动态库,包括头文件和库文件
bjam --toolset=msvc-8.0 --prefix=c:/boost_1_55_0/output1 --with-regex link=shared threading=multi variant=release runtime-link=shared  install
 
(3)只编译 release 版本 regex 动态库,包括库文件
bjam --toolset=msvc-8.0 --stagedir=c:/boost_1_55_0/output2--with-regex link=shared  threading=multi variant=release runtime-link=shared  stage


编译64位版本
和32位环境不同,x64环境下编译得先从开始菜单启动Visual Studio的Visual Studio 2008 x64 Win64 Command Prompt进入命令提示符,而不是随便打开任意一个命令行窗口就行。然后转到boost根文件夹,运行bootstrap.bat生成x64版的bjam.exe。然后运行命令:
上面的启动是错的。一周经验。直接到C:\Windows\SysWOW64中打开cmd.exe
1.进入$(boostDir)/boost_1_55_0 目录
2.执行bootstrap.bat
3.bjam --toolset=msvc-11.0 --prefix=c:/boost/x64 --without-python --build-type=complete  link=shared  threading=multi address-model=64 install




即可生成DLL版平台库,如果要编译静态库版就把shared改为static。
只生成一个库的话加上例如--with-python得编译选项,避免生成东西太多、时间太长。
需要注意的是address-model=64属性,如果没有这个属性的话,会默认生成32位的平台库,加入这个选项才能生成64位的DLL。


说明:
$(boostDir) 解压后boost_1_55_0存放目录
--toolset 为你的开发环境版本vs2005(msvc-8.0)vs2008(msvc_9.0)vs2012(msvc_11.0)...
--prefix 存放路径


在存放目录下生产lib和include文件夹加入开发环境即可

猜你喜欢

转载自blog.csdn.net/wqq_9/article/details/48802901