您的位置:首页 > 其它

boost 1.49在vs 2005下编译的方法

2013-07-23 16:40 253 查看
首先下载boost库,网上自己搜索。

然后解压到一个目录:如D:\boost_1_49_0。然打开vs2005的命令提示符,进行D:\boost_1_49_0目录:

1.运行bootstrap.bat。

2.运行如下命令:b2 install --prefix=库文件的目录(如:d:\lib) --toolset=msvc-8.0 --without-python。

如:b2 install --prefix=d:\lib --toolset=msvc-8.0 --without-python

大概运行40分钟左右,根据机器速度而来。

设定vs2005环境
Tools -> Options -> Projects and Solutions -> VC++ Directories

在Library files加上D:\lib\lib

在Include files加上D:\lib\include\boost-1_49

测试程序:

#include <iostream>
#include <string>
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string_regex.hpp>
using namespace std;
using namespace boost;
int main() {
string s = " Hello boost!! ";
trim(s);
cout << s << endl;
getchar();
std::string regstr = "a+";
boost::regex expression(regstr);
std::string testString = "aaa";
// 匹配至少一个a
if( boost::regex_match(testString, expression) )
{
std::cout<< "Match" << std::endl;
}
else
{
std::cout<< "Not Match" << std::endl;
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: