boost 1.49在vs 2005下编译的方法

首先下载boost库,网上自己搜索。

然后解压到一个目录:如D:oost_1_49_0。然打开vs2005的命令提示符,进行D:oost_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:liblib

在Include files加上D:libincludeoost-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;
}
}

原文地址:https://www.cnblogs.com/vk83/p/3208853.html