zoukankan      html  css  js  c++  java
  • VS2013中安装配置和使用Boost库

    源地址:http://www.itnose.net/detail/6077953.html

    时间:2014.07.24

    地点:基地

    --------------------------------------------------------------------------------------

    一、前言

      今天准备去看场电影《后会无期》,但在这之前,我想好好研究下大名鼎鼎的Boost库。

    --------------------------------------------------------------------------------------

    二、Boost安装

    2.1 Boost官网下载Boost最新版Version 1.55.0

    vs2013,boost,安装,配置0

    2.2将下载压缩包解压到本地

    解压后可看到文件夹下有个bootstrap.bat文件。

    2.3打开cmd命令窗口,运行bootstra.bat文件

    执行以下命令,具体根据自己的环境略有变化。

    vs2013,boost,安装,配置1

    最主要的目的是我们要运行bootstrap.bat文件

    执行完后,结果如下:

    vs2013,boost,安装,配置2

    然后在文件夹下我们会发现新生成了一个名为bjam.exe的文件

    vs2013,boost,安装,配置3

    2.4在cmd窗口中运行bjam.exe文件

    vs2013,boost,安装,配置4

    此过程将默认根据系统已经安装好的编译工具(VS2008,2010,2012,2013)等编译相应的Lib文件、头文件等。

    编译完成后如下:

    vs2013,boost,安装,配置5

    至此,Boost库安装完成

    2.5配置VS2013

    新建一个BoostTest工程文件,添加测试代码

    #include <boost/lexical_cast.hpp>     
    #include <iostream>     
    using namespace std;
    int main()
    {
    	using boost::lexical_cast;
    	int a = lexical_cast<int>("123");
    	double b = lexical_cast<double>("123.0123456789");
    	string s0 = lexical_cast<string>(a);
    	string s1 = lexical_cast<string>(b);
    	cout << "number: " << a << "  " << b << endl;
    	cout << "string: " << s0 << "  " << s1 << endl;
    	int c = 0;
    	try{
    		c = lexical_cast<int>("abcd");
    	}
    	catch (boost::bad_lexical_cast& e){
    		cout << e.what() << endl;
    	}
    	return 0;
    }

    再视图->属性页(VS2013在这才能找到相关的属性配置栏)->C/C++,在 附加包含目录添加或编辑Boost的文件路径,我的是:

    D:软件C_libraryoost_1_55_0

    vs2013,boost,安装,配置6
    在?>连接器选项附加库目录下添加Boost库lib文件路径,我的是:D:软件C_libraryoost_1_55_0libs

    vs2013,boost,安装,配置7

    2.6测试代码

    代码运行成功,说明Boost库一切配置顺利。

    vs2013,boost,安装,配置8

    接下来,就去尽情享受Boost带来的欢乐吧~

  • 相关阅读:
    BZOJ 3910 火车 倍增LCA
    CF1012B Chemical table 构造_思维_并查集
    CF 949C Data Center Maintenance_强联通分量_思维题
    CF949B A Leapfrog in the Array 思维题,推理
    关于前端的思考与感悟
    打造专属自己的html5拼图小游戏
    好看的轮播切换效果
    the compatibility problem of ie
    SVG Sprite 入门(SVG图标解决方案)
    Top 15
  • 原文地址:https://www.cnblogs.com/lanye/p/5405621.html
Copyright © 2011-2022 走看看