VS2005安装Boost_1_42_0

1.下载boost_1_42_0压缩文件,解压缩到d:/boost_1_42_0/目录下

2.编译bjam

从vs2005的工具菜单进入命令提示窗口(一定要从这进),cd到d:/boost_1_42_0/tools/jam/src下执行build.bat,会在d:/boost_1_42_0/tools/jam/src/bin.ntx86/產生bjam.exe,將bjam.exe複製到d:/boost_1_42_0/下。

3.设定编译环境

修改user-config.jam (d:/boost_1_42_0/tools/build/v2/user-config.jam) 的MSVC configuration

#     MSVC configuration

#     Configure msvc (default version
, searched in standard location
#     and PATH).
#     using msvc
;
using msvc : 8.0 : : <compileflags>/wd4819 <compileflags>/D_CRT_SECURE_NO_DEPRECATE <compileflags>/D_SCL_SECURE_NO_DEPRECATE <compileflags>/D_SECURE_SCL = 0 ;

4.编译boost

將目錄移至d:/boost_1_42_0/下執行

bjam --without-python --toolset=msvc-8.0 --prefix=d:/boost install(这是安装)

如果是得到release版的boost库的话,则用:

bjam --without-python --toolset=msvc-8.0 --prefix=d:/boost stage

如果想生成带gd字符的debug版的lib和dll文件,则用

bjam --without-python --toolset=msvc-8.0 --prefix=d:/boost debug stage

如果想生成带sgd字符的静态debug版的lib和dll文件,则用

bjam --without-python --tooset=msvc-8.0 --prefix=x:/boost debug runtime-link=static stage


參數說明
--without-python 表示不使用 python
--toolset : 所使用compiler,Visual Studio 2005為msvc-8.0
--prefix:指定編譯後library的安裝目錄

这一步要花很长时间(大约50分钟)
5.设定vs2005环境
Tools -> Options -> Projects and Solutions -> VC++ Directories
在Library files加上d:/boost/lib
在Include files加上d:/boost/include/boost-1_42_0
6.测试安装是否成功
#include <iostream>
#include <string>
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string_regex.hpp>
using namespace std;
using namespace boost;
int main() {
    string s = "    Hello boost!! ";
    trim(s);
    cout << s << endl;
    getchar();
       std::string regstr = "a+";
      boost::regex expression(regstr);
      std::string testString = "aaa";
      // 匹配至少一个a
      if( boost::regex_match(testString, expression) )
      {
          std::cout<< "Match" << std::endl;
      }
      else
      {
          std::cout<< "Not Match" << std::endl;
      }
}

 

输出结果:
成功了!~~
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值