VS2008使用boost的正则表达库regex的环境配置

来源:互联网 发布:linux 进程调度命令 编辑:程序博客网 时间:2024/06/05 15:32

最简单的,下载VS2008补丁:VS2008SP1ENUX1512962.iso

或者用以下方法:

1:首先下载boost源码:

下载地址:http://sourceforge.net/projects/boost/files/boost/

Win7下可以直接点解下载:http://sourceforge.net/projects/boost/files/boost/1.57.0/boost_1_57_0.zip/download

解压后看到里边是:



2:想要使用,自然需要编译出来我们需要的静态库:

使用VS2008的命令行:

开始--->所有程序--->Microsoft Visual Studio 2008--->Visual Studio Tools--->Visual Studio 2008 Command Prompt

3:双击bootstrap.bat过一会儿会生成b2.exe


4:双击b2.exe


5:配置:

当前路径下会生成文件夹stage,进去并进到lib里边:


6:VS的配置:






例子:

#include <iostream>#include <boost/asio.hpp>#include <boost/date_time/posix_time/posix_time.hpp>#include "boost/regex/v4/regex_match.hpp"using namespace std;int main(){boost::asio::io_service io;boost::asio::deadline_timer t(io, boost::posix_time::seconds(5));t.wait();cout << "Hello World!\n" << endl;return 0;}

配置过程中可能会遇到异常:

编译boost程序出现如下错误fatal error LNK1104: cannot open file libboost_regex-vc90-mt-gd-1_57.lib'的解决方法

http://www.tuicool.com/articles/nqUfm2

error RC1015: cannot open include file 'atlres.h'问题解决  

http://liuyangxdgs.blog.163.com/blog/static/29137763201244113458221/

error C2471: cannot update program database vc90.pdb

http://www.cnblogs.com/kex1n/archive/2012/01/14/2322164.html



参考:

http://blog.sina.com.cn/s/blog_496be0db0100yh5p.html

http://blog.csdn.net/farcall/article/details/6661699





0 0