vs2017 linux boost,Boost安装(win10 x64+vs2017+boost_1.68_0)

安装

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

解压到D:\Program Files

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

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

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

9b7f68ab0f89

bootstrap.png

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

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

9b7f68ab0f89

project-congif.png

run: .\b2 完成编绎。(耗时长)

9b7f68ab0f89

stage\lib.png

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

VS2017配置boost

新建项目

9b7f68ab0f89

new_project.png

编写代码

#include "pch.h"

#include

#include

using namespace std;

int main()

{

using boost::lexical_cast;

int a = lexical_cast("123");

double b = lexical_cast("123.0123456789");

string s0 = lexical_cast(a);

string s1 = lexical_cast(b);

cout << "number: " << a << " " << b << endl;

cout << "string: " << s0 << " " << s1 << endl;

int c = 0;

try {

c = lexical_cast("abcd");

}

catch (boost::bad_lexical_cast& e) {

cout << e.what() << endl;

}

}

修改调试平台

因为编译的静态库和动态链接是64位,选择64位平台

9b7f68ab0f89

debug.png

设置编译环境及链接

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;

调试运行

Fn + CTRL+F5 直接运行

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值