• vs2010配备boost编程环境


    vs2010配备boost编程环境

    vs2010配置boost编程环境

    第一步:下载boost,我下载的方法是从http://www.boost.org/上找最新的下载。名字叫boost_1_53_0。

     

    第二步:在D盘(最新的boost_1_53_0编译之后大小为5G多)创建一个目录boost,拷贝进去并解压到当前文件夹。(注,这里我没有创建boost目录,直接解压的)

     

    第三步:开始->程序->MicrosoftVisual Studio 2010->Visual Studio Tools->Visual Studio 命令提示(2010),打开一个控制台。

     

    第四步:cd d:oostoost_1_53_0

     

    第五步:bootstrap.bat

     

    第六步:(1)b2 --toolset=msvc-10.0 --build-type=complete stage或者(2)bjam.exe--toolset=msvc-10.0 --build-type=complete。等待执行完成。

    全部编译的命令行:d:oost>bjam --toolset=msvc-11.0 --build-type=complete stage

    部分编译的命令行:d:oost>bjam --toolset=msvc-11.0 --with-date_time --with-thread

    查看需要编译库的命令行:bjam --show-libraries

    编译成64位的命令:bjam --toolset=msvc-11.0 address-model=64 --build-type=complete stage 

    注:我在这里第五步之后会生成了bjam.exe和b2.exe.这里我执行(1)成功,执行(2)失败。

     

    测试:

    第一步:创建一个工程,附加包含目录为:d:oostoost_1_53_0;附加库目录为:d:oostoost_1_53_0stagelib。

    注:在2010环境下这步,在项目-->右键属性-->VC++ Directories 中去填写对应路径

    这两步我的配置的时候是:(1)D:oost_1_53_0   (2)D:oost_1_53_0stagelib

    D:/cpp/boost_1_46_1;$(IncludePath)

    D:/cpp/boost_1_46_1/stage/lib;$(LibraryPath)

    第二步:编写代码测试。

    注:如果编写的测试代码出现类似错误”无法打开包括文件:“boost/regex.hpp”: No such file or directory” 说明附件包含目录出现错误,这时要纠正包含目录。

    如果在下还有incude目录,我们只需包含includes目录就加载了相关头文件,如果没有,如上加载总目录,让编译器自己找。

    附加:据说在第六步的时候,如果将执行指令里面的“stage”改成”install”,则会生成include指令。

     附加测试代码:

     C++ Code 

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17

    #include<iostream>
    #include <boost/regex.hpp>
    using namespace std;

    int main()
    {
        // 3 digits, a word, any character, 2 digits or "N/A", 
        // a space, then the first word again
        boost::regex reg("\d{3}([a-zA-Z]+).(\d{2}|N/A)\s\1");

        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);
        cout<<"Hello Boost !"<<endl;
    }

    如果输出结果为:

  • 相关阅读:
    EF4.3 到底能不能用?
    系统架构师(详解+转)
    silverlight MD5加密
    silverlight自定义安装客户端插件
    vs2010中文安装英文版silverlight5,和MVC 3
    如何自定义gridview的表格显示?
    Scott Mitchell的ASP.NET2.0数据指南中文版索引
    成功软件开发者的9种编程习惯(一)
    第8章 商品目录管理
    6/29 项目目录结构有所调整
  • 原文地址:https://www.cnblogs.com/gjianw217/p/4103656.html
Copyright © 2020-2023  润新知