boost庫 在Windows平台的安裝

來源:互聯網
上載者:User

轉載http://blog.csdn.net/isilent/article/details/7400359

1.下載boost

從http://www.boost.org/上下載boost庫,目前的版本是1.52

boost_1_52_0\ .................The “boost root directory”      index.htm .........A copy of www.boost.org starts here      boost\ .........................All Boost Header files      libs\ ............Tests, .cpps, docs, etc., by library              index.html ........Library documentation starts here              algorithm\              any\              array\                                               …more libraries…      status\ .........................Boost-wide test suite      tools\ ...........Utilities, e.g. Boost.Build, quickbook, bcp      more\ ..........................Policy documents, etc.      doc\ ...............A subset of all Boost library docs


2.編譯

boost的一部分庫都是由hpp檔案組成,因此可以直接引用,而無需編譯。但也有一部分需要編譯成二進位代碼,為了今後方便,我們可以全部先編譯一遍。

1. 運行bootstrap.bat,完畢後會產生bjam.exe

2. 運行bjam.exe, 

bjam.exe --toolset=msvc-9.0 --link=static --runtime-link=shared --threading=multi --without-python stage debug release

這時應該根據自己的需要考慮是否進行完全編譯,若完全編譯的話,簡單地執行命令 bjam --toolset=msvc-9.0 --build-type=complete 就可以了。(這裡用的是VC2010)


3.將boost添加到程式碼程式庫中boost目錄是標頭檔,stage\lib是靜態連結庫,根據需要拷貝到程式碼程式庫即可。如果只在本機上使用,也可以直接在VS中設定include和附加庫目錄。、輸出代碼
#include <boost/timer.hpp>#include <iostream>using namespace boost;using namespace std;int main(){timer t;cout << t.elapsed_max() / 3600 << "h" << endl;getchar();return 0;}

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.