VS 2013 編譯和使用 Boost


以 1.58.0 版本 boost 為例, 當前系統版本為 Windows 8.1 x64  

 

 

1 編譯boost 

當前解壓路徑 "D:\Libraries\boost_1_58_0" 

1) 打開VS2013命令提示符 

Boost_Developer_Command_Prompt

Boost_Administrator

2) 運行 bootstrap.bat 

注意全程不要關閉命令提示符, 所有操作均在此中完成

Boost_booststrap

Boost_booststrap_comp

3) 運行 b2.exe 或 bjam.exe 

① 查看編譯選項, 在命令提示符下輸入"b2 --help"

Boost_b2_help

請注意以下幾個編譯選項

Properties:

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版本, 多線程和單線程版本


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM