Boost庫是C++領域公認的經過千錘百煉的知名C++類庫,涉及編程中的方方面面,簡單記錄一下使用時的安裝過程
1.boost庫的下載
boost庫官網主頁:www.boost.org
2.安裝
將下載的壓縮包解壓到指定的目錄
3.建立編譯工具bjam.exe
在源碼目錄下執行bootstrap.bat,生成bjam.exe
4.在命令行模式下利用bjam編譯boost庫,這裡利用VS2012自帶的命令行工具
D:\Program Files\VS2012\VC>cd D:\Program Files\BoostSDK\boost
D:\Program Files\BoostSDK\boost>bjam stage
D:\Program Files\BoostSDK\boost>bjam stage --toolset=msvc-11.0 --without-graph -
-without-graph_parallel --without-mpi --without-wave --stagedir="D:\Program File
s\BoostSDK\bin\vc110" link=static runtime-link=shared runtime-link=static thread
ing=multi debug release
說明:
--toolset 指明編譯工具,msvc-11.0表示Visual Studio 2012
--stagedir 指明編譯後庫文件的存放路徑
--without-mpi表示不編譯mpi庫,其他的--without類似
boost庫中有些庫是必須要編譯才能使用的,大部分只要引用頭文件即可,少數是必須編譯成二進制文件的。
摘用官方文檔的一點說明:
The first thing many people want to know is, “how do I build Boost?” The good news is that often, there's nothing to build.
Nothing to Build?
Most Boost libraries are header-only: they consist entirely of header files containing templates and inline functions, and require no separately-compiled library binaries or special treatment when linking.
The only Boost libraries that must be built separately are:
A few libraries have optional separately-compiled binaries:
5.安靜的等待庫的編譯完成