#眉標=Boost #副標=「Boost技術與應用」系列文章(1) #大標=Boost綜覽、建置與安裝 #作者=文/侯捷 ==本文相關資訊 =========== * 讀者基礎:具備C++ templates編程經驗與C++標準程式庫使用經驗。 * 本文測試環境:VC6、VS2003。 * 本系列文章將匯整至編寫中的《Boost運用與源碼剖析》。 * 關鍵術語:C++ Standard Library、Boost、TR1。 ================ ========================= @echo off rem environment setting to build Boost 1.33.0, using VC6. set MSVC_ROOT=C:\MSDEV\VC98 set PATH=C:\MSDEV\VC98\BIN;C:\MSDEV\VB98 set INCLUDE=C:\MSDEV\VC98\INCLUDE;C:\MSDEV\VC98\MFC\INCLUDE set LIB=C:\MSDEV\VC98\LIB;C:\MSDEV\VC98\MFC\LIB ============================== == Boost的 *.hpp =========== 讀者想必對 "Boost" 源碼以 .hpp為副檔名感到好奇。副檔名(檔案延伸名)傳達的意義是檔案的類型(種類),'.h' 副檔名表示header,意義很好,從C開始便被使用並沿用至C++,但我們卻因此分辨不出C headers或 C++ headers(雖然C++可吃進C headers)。C++ Standard的header命名規則是「無副檔名」,這又不太對勁,沒有傳達出任何意義,我們因此必須檢閱檔案內容才能知道其類型。'.hpp' 可以毫不模糊地標示出一個C++ header file,並且不會對任何現存常規產生不好的影響。================ ================== bjam "-sTOOLS=msvc" install ==================== =================================== bjam "-sTOOLS=msvc" --prefix=D:\Boost install ==================================== ========================================== bjam "-sTOOLS=msvc" --with-regex install ======================================== ====================== boost_regex-vc6-mt-gd-1_33.dll boost_regex-vc6-mt-gd-1_33.lib boost_regex-vc6-mt-1_33.dll boost_regex-vc6-mt-1_33.lib libboost_regex-vc6-sgd-1_33.lib libboost_regex-vc6-mt-sgd-1_33.lib libboost_regex-vc6-mt-gd-1_33.lib libboost_regex-vc6-s-1_33.lib libboost_regex-vc6-mt-s-1_33.lib libboost_regex-vc6-mt-1_33.lib boost_regex-vc6-mt-gd.lib boost_regex-vc6-mt.lib libboost_regex-vc6-sgd.lib libboost_regex-vc6-mt-sgd.lib libboost_regex-vc6-mt-gd.lib libboost_regex-vc6-s.lib libboost_regex-vc6-mt-s.lib libboost_regex-vc6-mt.lib =============================== =================================== bjam "-sTOOLS=vc-7_1" --prefix=D:\Boost install ======================================= ==參考資料 =========== * 《Effective C++》3/e, by Scott Meyers, A.W. 2005. Item54: "Familiarize yourself with the standard library, including TR1". Item55: "Familiarize yourself with Boost". * 《Beyond the C++ Standard Library, An Introduction to Boost》by Bj?rn Karlesson, A.W. 2005. * Boost Libraries Documentation, from http://www.boost.org ================ ==作者簡介 =========== 侯捷 資訊顧問、專欄主筆、大學執教。常著文章自娛,頗示己志。 侯捷網站:http://www.jjhou.com(繁體) 北京鏡站:http://jjhou.csdn.net(簡體) 永久郵箱:jjhou@jjhou.com ================