码迷,mamicode.com
首页 > 其他好文 > 详细

vs2010 boost库的编译与安装

时间:2015-12-15 20:49:16      阅读:194      评论:0      收藏:0      [点我收藏+]

标签:

编译过程:

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下配置成功。

vs2010 boost库的编译与安装

标签:

原文地址:http://www.cnblogs.com/dfyz/p/5049188.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!