美文网首页
Boost安装(win10 x64+vs2017+boost_1

Boost安装(win10 x64+vs2017+boost_1

作者: 醒醒去睡吧 | 来源:发表于2018-09-26 23:35 被阅读0次

综合自:https://blog.csdn.net/s_lisheng/article/details/72871218 以及
https://blog.csdn.net/davidhopper/article/details/78243987

安装

  1. Boost下载(http://www.boost.org/):boost_1_68_0.zip

  2. 解压到D:\Program Files

  3. 为vs2017添加环境变量PATH: D:\Program Files\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\bin\HostX64\x64

  4. 在 x64 Native Tools Command Prompt for VS 2017(或者 Developer Command Prompt for VS 2017)中进入boost目录:cd d:\program files\boost_1_68_0

  5. 输入bootstrap.bat (或bootstrap.bat vc141 显式地指定VC版本版本号为:VS2017-->vc141)


    bootstrap.png
  6. 在d:\program files\boost_1_68_0目录中生成了b2.exe和bjam.exe

  7. 在目录d:\program files\boost_1_68_0下有一个项目配置文件project-config.jam,用记事本或其他文本编辑工具打开,做如下修改:


    project-congif.png
  8. run: .\b2 完成编绎。(耗时长)


    stage\lib.png
  9. 过一段时间后在文件夹d:\program files\boost_1_68_0\bin\vc14\lib下生成.dll及.lib文件。d:\program files\boost_1_68_0\bin.v2是编译产生的临时目录,可删除。

VS2017配置boost

  1. 新建项目


    new_project.png
  2. 编写代码

#include "pch.h"
#include <iostream>
#include <boost/lexical_cast.hpp>     
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;
    }
}
  1. 修改调试平台
    因为编译的静态库和动态链接是64位,选择64位平台


    debug.png
  2. 设置编译环境及链接
    Debug-->boosttest properties...

  • C/C++ -->General-->Additional Include Directories附加包含目录:
    D:\Program Files\boost_1_68_0;
  • Linker-->General-->Additional Library Directories附加库目录:
    D:\Program Files\boost_1_68_0\stage\lib;
  1. 调试运行
    Fn + CTRL+F5 直接运行

转载自:https://blog.csdn.net/litingcheng1126/article/details/70337821 以及 https://blog.csdn.net/u010921682/article/details/80179732

相关文章

  • Boost安装(win10 x64+vs2017+boost_1

    综合自:https://blog.csdn.net/s_lisheng/article/details/72871...

  • mac boost 安装

    源码编译安装: boost安装官网 下载Boost源码 解压放在任意目录,例如/usr/local/boost_1...

  • pIRS的安装和简单使用

    [TOC] 安装Boost C++ library 安装pIRS过程中遇到未安装Boost C++ library...

  • Mac安装boost

    boost安装 1.boost安装包下载https://sourceforge.net/projects/boos...

  • boost在ubuntu16,windows10的安装

    https://www.boost.org/ 下载boost文件 boost在Ubuntu下安装 tar xvzf...

  • Thrift centos7 安装

    安装centos需要的扩展 安装boost,本地源码安装最安全 笔者在安装boost的时候,使用的yum inst...

  • 安装EOS 4.2

    安装boost 网页下载boost最新包替换script/eosio_build_ubuntu.sh 中boost...

  • treemix 安装

    先安装两个依赖软件boost(v>1.42)和gsl boost安装 1.下载 解压 编译和安装 gsl安装 1....

  • Windows下编译和使用websocketpp

    编译安装Boost WebSocketpp依赖于Boost,因此在使用WebSocketpp前需要编译安装Boos...

  • boost库

    Linux下安装使用boost库 apt命令安装 这两个命令可以安装默认版本的boost库,如果想安装特定版本,需...

网友评论

      本文标题:Boost安装(win10 x64+vs2017+boost_1

      本文链接:https://www.haomeiwen.com/subject/tzzjoftx.html