zoukankan      html  css  js  c++  java
  • 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:oostoost_1_69_0invc141-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

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

  • 相关阅读:
    HereDOC案例
    array_number
    CodeMirror---实现关键词高亮
    webstorage的使用
    vue.js--绑定方法到window对象
    docker部署服务实现文件上传到本地问题解决
    ES6之map与set
    JAVA生成视频缩略图的两种方式
    vuex状态管理
    ELK日志分析平台
  • 原文地址:https://www.cnblogs.com/HackerArt/p/10539516.html
Copyright © 2011-2022 走看看