Boost库的安装 (boost_1_47_0 + VS2008)

2 篇文章 0 订阅

一、下载boost_1_47_0安装包

http://www.boost.org/users/history/
http://sourceforge.net/projects/boost/files/boost/1.47.0/

百度网盘下载:
boost_1_47_0已编译版本下载
boost_1_47_0下载

二、解压

三、运行\boost_1_47_0\bootstrap.bat得到\boost_1_47_0\bjam.exe

四、进入VS2008的命令提示窗口:启动VS2008,Tools->Visual Studio 2008 Command Prompt。

cd到boost的目录\boost_1_47_0\。
(64位: Tools->Visual Studio 2008 x64 Win64 Command Prompt)

五、输入bjam –toolset=msvc-9.0 –build-type=complete stage开始编译。

大概30分钟后编译完成,生成的库文件位于\boost_1_47_0\stage\lib\下。
(64位: bjam –toolset=msvc-9.0 –build-type=complete address-model=64 stage)

六、设定VS2008的环境

Tools->Options->Projects and Solutions->VC++ Directories
添加Include files: \boost_1_47_0\
添加Library files: \boost_1_47_0\stage\lib\
但有时会有问题,那就设置工程的属性:
C/C++->General->Additional Include Directories: \boost_1_47_0\
Linker->General->Additional Library Directories: \boost_1_47_0\stage\lib\

七、编写测试程序(Windows控制函程序)

#include <iostream>
#include <string>
#include <boost/lexical_cast.hpp> 
#include <boost/regex.hpp>

using namespace std;
using boost::lexical_cast;
using boost::regex;

int main() 
{ 
    double d = lexical_cast<double>("123.0123456789");
    cout << d << endl;

    regex reg("[\\s\\S]*.bmp");
    string str = "123.bmp";
    if (boost::regex_match(str, reg))
    {
        cout << "match" << endl;
    }
    else
    {
        cout << "not match" << endl;
    }

    return 0;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值