zoukankan      html  css  js  c++  java
  • vs2005下安装boost

    网上有很多安装方法,以下是我成功安装的步骤

    1.下载boost_1_34_1压缩文件,解压缩到d:"boost_1_34_1"目录下

    2.编译bjam

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

    3.设定编译环境

    修改user-config.jam (d:"boost_1_34_1"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_34_1"下執行

    參數說明 --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_34_1

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

    }

    输出结果:

  • 相关阅读:
    基于vue-cli快速构建
    '无法将“vue”项识别为 cmdlet、函数、脚本文件或可运行程序的名称' 或 'vue不是内部或外部命令' 的解决方法
    js / ajax 成功提交后怎么跳转到另外一个页面?
    SpringMVC 拦截器不拦截静态资源的三种处理方式方法
    各种JSON的maven引用
    java版微信公众号支付(H5调微信内置API)
    阿里云MongoDB存储数据
    阿里RocketMq(TCP模式)
    Nginx 简单安装
    Redis-主从复制
  • 原文地址:https://www.cnblogs.com/chenhs/p/1270754.html
Copyright © 2011-2022 走看看