標籤:
編譯過程:
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庫的編譯與安裝