windows系统VS2017编译boost

1. 下载boost, 解压,进入boost源目录

2. 打开vs2017 x86 CMD工具,输入bootstrap.bat,等待初始化完毕

x86编译

bjam stage --toolset=msvc-14.1 --without-graph --without-graph_parallel --stagedir="D:\boost\boost_1_69_0\bin\vc141-x86" link=static runtime-link=shared runtime-link=static threading=multi debug release

3. VS2017

创建测试项目

// TestBoost.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//

#include "pch.h"

#include <boost/lexical_cast.hpp>
#include <boost/regex.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;
}

配置头文件和库目录

image

清理,重新生成,运行,测试。

转载于:https://www.cnblogs.com/HackerArt/p/10539516.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值