|
Boost 實際上是由幾十個不同功能的函數庫組成的 C++ 函數庫集合(Set of libraries),它最初是由 C++Standard Committee 的部分委員發(fā)起并開發(fā),含有眾多能夠極大拓展 C++ 語言功能和易用性的函數。它的風格與標準模板庫相似,跨平臺并且通用性很強,并且其很多組成庫已經被收錄在 C++11 新標準中,可以被看作C++標準庫的官方擴展版。以下是個人總結的 Boost 在 Visual Studio 2010 下安裝配置筆記,僅供參考。 首先下載Boost函數庫并解壓,截止2012/6/8最新版本為1.49.0,點此下載,也可訪問www.boost.org獲取最新版boost。
附:VS2010 靜態(tài)鏈接 Boost 函數庫的配置方法: 是為記。 如需轉載,請保持文章完整性,并注明作者和出處。 (我從這里轉的,不過這個人似乎也是從別人那里轉的,原文作者是誰就不清楚了。http://blog.csdn.net/juhanzhang/article/details/8247294) ----------------------------------------------------------------------------------------------------------------- 在VS2010中使用boost也很簡單, 下面是使用方法: 1、Properties > C/C++ > General > Additional Include Directories這里設定包含頭文件的路徑 例如: D:\boost\boost_1_54_0 (到Boost目錄的上一級) 2、Properties > C/C++ > Precompiled Headers ,: Not Using Precompiled Headers: 禁用頭文件 3、Properties > Linker > General > Additional Library Directories添加包含的庫目錄 例如: D:\boost\boost_1_54_0\stage\lib 驗證是否安裝成功請新建工程example, 設置好屬性后編譯下面的程序: #include <boost/regex.hpp> #include <iostream> #include <string> int main() { std::string line; boost::regex pat( "^Subject: (Re: |Aw: )*(.*)" ); while (std::cin) { std::getline(std::cin, line); boost::smatch matches; if (boost::regex_match(line, matches, pat)) std::cout << matches[2] << std::endl; } } 然后將下面的內容保存為test.txt測試文件 To: George Shmidlap
From: Rita Marlowe
Subject: Will Success Spoil Rock Hunter?
---
See subject.在dos窗口執(zhí)行編譯好的.exe文件, 將test.txt文本內容重定向為輸入. path\to\compiled\example < path\to\test.txt如果輸出如下:Will Success Spoil Rock Hunter? 則表示安裝成功. Good Luck! |
|
|
來自: haodafeng_org > 《雜項》