boost 1.49在vs 2005下编译的方法

首先下载boost库,网上本身搜索。python

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

1.运行bootstrap.bat。express

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

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

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

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

在Library files加上D:\lib\libget

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

测试程序:it

#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;
}
}io

相关文章
相关标签/搜索