• boost 1.67编译VS2017版本


    最近想系统学习并使用一下boost的asio异步网络库,所以需要编译boost库使用,下面简单介绍如何编译。

    编译环境

    boost1.67版本,windows 10,VS2017

    下载boost

    建议到官网去下载,目前最新的是1.67版本,链接:https://dl.bintray.com/boostorg/release/1.67.0/source/,会提供很多压缩方式的压缩包,我选择了zip版本的。

    解压

    把压缩包boost_1_67_0.zip解压到当前目录,得到boost_1_67_0目录。

    编译

    直接进入boost_1_67_0目录,双击运行脚本bootstrap.bat,编译boost编译引擎(Building Boost.Build engine)。等待几分钟,就会编译出b2.exe和bjam.exe,这小步骤就表示成功了。

    新建一个build_vs2017.bat脚本文件,输入如下内容:

    @ECHO OFF
    
    ECHO Building Boost lib, vs2017
    
    bjam.exe install --prefix="boost_1_67_vs2017" --toolset=msvc-14.1  link=static runtime-link=shared threading=multi debug release

    执行程序bjam.exe,后面的参数可执行bjam.exe --help来了解具体内容

    install                        Install headers and compiled library files to the configured locations (below).

    --prefix=<PREFIX>   Install architecture independent files here.Default; C:Boost on Win32; Default; /usr/local on Unix. Linux, etc.

    toolset=toolset         Indicate the toolset to build with.

    link=static|shared     Whether to build static or shared libraries

    runtime-link=static|shared Whether to link to static or shared C and C++ runtime.

    threading=single|multi  Whether to build single or multithreaded binaries

    等待10多分钟,即可看到当前目录下有一个目录boost_1_67_vs2017,里面则是编译出来的库,其中还包括头文件。里面的库比较多,为了方便引用具体的库,可参考库的命名规范:

    http://www.cppblog.com/Robertxiao/archive/2013/01/06/197022.html

    总结

    总体来说,boost编译还是比较简单的,或者说官方提供了比较友好的编译方式,为广大的使用者减少负担,点赞。

  • 相关阅读:
    entityframework学习笔记--002-database first
    ServletContext总结
    form 表单提交类型
    对称加密与非对称加密
    跨域详解
    https工作原理
    Entity Framework数据库初始化四种策略
    Modbus 协议解析
    CAFFE(FAQ.2):Ubuntu 配置caffe 框架之数据库读取,错误解决:ImportError: No module named leveldb解决办法
    CAFFE(0):Ubuntu 下安装anaconda2和anaconda3
  • 原文地址:https://www.cnblogs.com/qinwanlin/p/boost.html
Copyright © 2020-2023  润新知