编译过程:
1.首先去http://www.boost.org/users/download/下载boost的源码;
2.然后将源码放入一个文件加内,比如c:\lib\boost\boost_1_59_0\下
3.进入Visual Studio x64命令提示(2010)窗口,cd到c:\lib\boost\boost_1_59_0\中
4.执行命令:
bootstrap
b2--toolset=msvc-10.0 --build-type=complete stage
The first command prepares the Boost.Build system for use. The second command invokes Boost.Build to build the separately-compiled Boost libraries.
vs2010C++工程安装boost库:
在2010环境下这步,在项目-->右键属性-->VC++ Directories 中去填写对应路径
附加包含目录为:c:\lib\boost\boost_1_59_0\;附加库目录为:c:\lib\boost\boost_1_59_0\stage\lib
测试代码:
#include<iostream>
#include <boost/regex.hpp>
using namespace std;
int main()
{
// 3 digits, a word, any character, 2 digits or "N/A",
// a space, then the first word again
boost::regex reg("\\d{3}([a-zA-Z]+).(\\d{2}|N/A)\\s\\1");
std::string correct="123Hello N/A Hello";
std::string incorrect="123Hello 12 hello";
assert(boost::regex_match(correct,reg)==true);
assert(boost::regex_match(incorrect,reg)==false);
cout<<"Hello Boost !"<<endl;
}
如果输出结果为:Hello Boost ! 则表明boost库在vs2010下配置成功。