VS 2013 编译和使用 Boost

以 1.58.0 版本 boost 为例, 当前系统版本为 Windows 8.1 x64  bootstrap

 

 

1 编译boost 多线程

当前解压路径 "D:\Libraries\boost_1_58_0" 测试

1) 打开VS2013命令提示符 ui

Boost_Developer_Command_Prompt

Boost_Administrator

2) 运行 bootstrap.bat spa

注意全程不要关闭命令提示符, 全部操做均在此中完成线程

Boost_booststrap

Boost_booststrap_comp

3) 运行 b2.exe 或 bjam.exe debug

① 查看编译选项, 在命令提示符下输入"b2 --help"3d

Boost_b2_help

请注意如下几个编译选项blog

Properties:it

toolset=toolset
Indicate the toolset to build with.

variant=debug|release
Select the build variant

link=static|shared
Whether to build static or shared libraries

threading=single|multi
Whether to build single or multithreaded binaries

runtime-link=static|shared
Whether to link to static or shared C and C++ runtime.

② 编译, 在命令提示符下输入"b2 link=static threading=multi"

注意此处的选项要根据工程的须要去编译, 若是仅仅为了测试编译过程, 能够不带任何参数

Boost_b2

 

2 使用boost 

在工程的属性设置"VC++ Directories"中的Include和Library中增长boost, 以下图配置 

 Boost_VS2013

 

3 注意事项 

1) 连接不成功, 找不到xxx.lib

多是编译选项和boost的编译选项不一致致使的,

请按照工程的编译选项从新编译boost或修改vs的配置和boost中配置一致. 

2) 屡次编译boost, 使用b2编译时, 可不作清理, 可同时编译出debug和release版本, 多线程和单线程版本

相关文章
相关标签/搜索