編譯:
1.從http://sourceforge.net/projects/boost/files/boost/1.55.0/下載boost源代碼
2. 在工具欄啓動 “VS2013 開發人員命令提示”,進入boost的解壓目錄,即D:\boost_1_55_0, 輸入bootstrap,便在boost根目錄下生成bjam.exe文件。
3. bjam –showlibararies顯示編譯參數,選擇合適的編譯參數
4. 編譯例子有:
全部編譯的命令行:bjam –toolset=msvc-12.0 –build-type=complete stage
部分編譯的命令行:bjam –toolset=msvc-12.0 –with-date_time –with-thread
編譯成64位的命令:bjam –toolset=msvc-12.0 address-model=64 –build-type=complete stage
使用:
運行程序時發生錯誤error LNK1104: cannot open file ‘libboost_thread-vc100-mt-gd-1_55.lib’。本來是想讓VS動態鏈接boost庫的,結果總是出現VS找不到以lib開頭的靜態庫的問題。解決辦法和原因是:
put BOOST_ALL_DYN_LINK in preprocessor definition. If the BOOST_ALL_DYN_LINK is not defined, boost looks for static library, that is why its looking for libboost_thread-vc100-mt-gd-1_55.lib。