Boost 实际上是由几十个不同功能的函数库组成的 C++ 函数库集合(Set of libraries),它最初是由 C++Standard Committee 的部分委员发起并开发,含有众多能够极大拓展 C++ 语言功能和易用性的函数。它的风格与标准模板库相似,跨平台并且通用性很强,并且其很多组成库已经被收录在 C++11 新标准中,可以被看作C++标准库的官方扩展版。以下是个人总结的 Boost 在 Visual Studio 2010 下安装配置笔记,仅供参考。 首先下载Boost函数库并解压,截止2012/6/8最新版本为1.49.0,点此下载,也可访问www.boost.org获取最新版boost。
附:VS2010 静态链接 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窗口执行编译好的.exe文件, 将test.txt文本内容重定向为输入. path\to\compiled\example < path\to\test.txt 如果输出如下:Will Success Spoil Rock Hunter? 则表示安装成功. Good Luck! |
|
来自: haodafeng_org > 《杂项》