在Windows和Visual Studio上安装Boost

下载并安装boost

1,在boost的网站上下载一个boostWindows版本的安装器。

http://www.boost-consulting.com/download/windows

这个程序会自动下载和安装boost

整个Boost有接近1G那么大。

2,或者你也可以直接在boost网站上下载完整版的boost,下载以后安装。

boost_1_34_1.exe

    建议你使用第一种方式下载。因为那个程序的下载速度非常快。我选择的是从日本下载。

 

 

 

 

Visual Studio中启用boost

需要在项目属性中附加boost的目录。

    我选择的安装Boost的目录如下:

D:C++Runtimboostboost_1_34_1

 

1,在“附加包含目录”中添加对boost头文件目录的包含。以便正确include boost的头文件。

对于我的配置来说,这里需要输入D:C++Runtimboostboost_1_34_1

 

这个目录下面包含了头文件:

 

2,还需要附加boostlibdll文件

在“附加库目录”中包括boostlib库目录文件夹。

对于我的配置来说,这里需要输入D:C++Runtimboostboost_1_34_1lib

 

 

现在,可以编写我们的第一个boost程序了。

 

#include "stdafx.h"

 

#include <iostream>

#include <cassert>

#include <string>

#include "boost/regex.hpp"

 

int main() {

// 3 digits, a word, any character, 2 digits or "N/A", 

     // a space, then the first word again 

     boost::regex reg("d([a-zA-Z]+).(d|N/A)s1"); 

     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);

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值