vs2010 boost庫的編譯與安裝

來源:互聯網
上載者:User

標籤:

編譯過程:

1.首先去http://www.boost.org/users/download/下載boost的源碼;

2.然後將源碼放入一個檔案加內,比如c:\lib\boost\boost_1_59_0\下

3.進入Visual Studio x64命令提示(2010)視窗,cd到c:\lib\boost\boost_1_59_0\中

4.執行命令:

bootstrap

b2--toolset=msvc-10.0 --build-type=complete stage

 The first command prepares the Boost.Build system for use. The second command invokes Boost.Build to build the separately-compiled Boost libraries.

vs2010C++工程安裝boost庫:

在2010環境下這步,在項目-->右鍵屬性-->VC++ Directories 中去填寫對應路徑

附加元件封裝含目錄為:c:\lib\boost\boost_1_59_0\;附加庫目錄為:c:\lib\boost\boost_1_59_0\stage\lib

測試代碼:

 #include<iostream>
#include <boost/regex.hpp>
using namespace std;

int main()
{
    // 3 digits, a word, any character, 2 digits or "N/A", 
    // a space, then the first word again
    boost::regex reg("\\d{3}([a-zA-Z]+).(\\d{2}|N/A)\\s\\1");

    std::string correct="123Hello N/A Hello";
    std::string incorrect="123Hello 12 hello";

    assert(boost::regex_match(correct,reg)==true);
    assert(boost::regex_match(incorrect,reg)==false);
    cout<<"Hello Boost !"<<endl;
}

如果輸出結果為:Hello Boost ! 則表明boost庫在vs2010下配置成功。

vs2010 boost庫的編譯與安裝

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.