轉:http://blog.csdn.net/GeoLiMao/archive/2010/10/15/5943605.aspx
自己也按照這個教程試過,是可以的~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~·
1:下載Boost。文件爲boost_1_44_0.zip。
2:下載Boost Jam。文件爲boost-jam-3.1.18-1-ntx86.zip。
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~·
其次,編譯Boost。
1:解壓Boost和Boost Jam。將”(解壓目錄)\boost-jam-3.1.18-1-ntx86\bjam.exe“拷貝到”(解壓目錄)\boost“目錄下(與 boost-build.jam文件在同一目錄)。
2:編譯。打開命令行工具(CMD或者powershell),cd到\boost,輸入bjam.exe即開始編譯。
3:bjam.exe 的編譯參數(本人主要關心--with-<library>)
--build-dir=<builddir> 編譯的臨時文件會放在builddir裏(這樣比較好管理,編譯完就可以把它刪除了)
--stagedir=<stagedir> 存放編譯後庫文件的路徑,默認是stage
--build-type=complet 編譯所有版本,不然只會編譯一小部分版本
variant=debug|release 決定編譯什麼版本(Debug or Release?)
link=static|shared 決定使用靜態庫還是動態庫。
threading=single|multi 決定使用單線程還是多線程庫。
runtime-link=static|shared 決定是靜態還是動態鏈接C/C++標準庫
--with-<library> 只編譯指定的庫,如輸入--with-regex就只編譯regex庫了。
--show-libraries 只編譯指定的庫,如輸入--with-regex就只編譯 regex庫了。
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
至此,Boost已經能用了。下面是VS配置和使用。
1:把(解壓目錄)\boost添加到VS環境變量include中。
2:頭文件中包含#include <boost/XXX.hpp>。