Visual Studio 2019安装boost 1.7.0库

这篇具有很好参考价值的文章主要介绍了Visual Studio 2019安装boost 1.7.0库。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

小结

在Visual Studio 2019使用了boost 1.7.0库,经过编译boost 1.7.0库,再添加配置到VS 2019工程中,进行了成功地测试。

问题

找不到boost的源文件

如果没有安装boost库,会在Visual Studio 2019的工程编译过程中找不到相应的源文件。
参见C++ problem: boost/asio.hpp non existing

boost库的版本问题

如果boost库的安装版本不对的话,会返回类似c2664 cannot convert executor to any_io_executor &的错误,参见Compiler Error C2664 , 这里我的情况是安装的boost库过高,安装了boost 1.7.9的库,原因不确定,但是安装低一点的版本boost 1.7.0库,这个问题就没有了。

也有安装的版本过低的情况,也是有问题。返回类似LINK : fatal error LNK1104: cannot open file 'libboost_filesystem-vc141-mt-gd-x32-1_66.lib'的问题。

参见:
fatal error LNK1104: cannot open file ‘libboost_system-vc110-mt-gd-1_51.lib’

boost 1.7.0库的安装

参见https://www.boost.org/users/history/version_1_70_0.html,下载boost 1.7.0库Windows Zip文件,解压缩。

参见fatal error LNK1104: cannot open file 'libboost_system-vc110-mt-gd-1_51.lib’的过程进行安装。

首先需要执行以下VsDevCmd.bat指令,启动Visual Studio 2019 Developer Command Prompt v16.11.17

C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\Tools>VsDevCmd.bat
**********************************************************************
** Visual Studio 2019 Developer Command Prompt v16.11.17
** Copyright (c) 2021 Microsoft Corporation
**********************************************************************

否则会出现以下错误,
'cl' is not recognized as an internal or external command, operable program or batch file
和以下错误:
fatal error C1034: ctype.h: no include path set

参考Building Boost.Build engine ‘cl’ is not recognized as an internal or external command, operable program or batch file
how to install boost correctly
Error “fatal error C1034: windows.h: no include path set”

再执行bootstrap.bat

C:\boost_1_70_0>bootstrap.bat
Building Boost.Build engine

Generating Boost.Build configuration in project-config.jam for msvc...

Bootstrapping is done. To build, run:

    .\b2

To adjust configuration, edit 'project-config.jam'.
Further information:

    - Command line help:
    .\b2 --help

    - Getting started guide:
    http://boost.org/more/getting_started/windows.html

    - Boost.Build documentation:
    http://www.boost.org/build/

接着执行b2,生成library文件:

C:\boost_1_70_0>.\b2
Performing configuration checks

    - default address-model    : 32-bit
    - default architecture     : x86

Building the Boost C++ Libraries.


    - C++11 mutex              : yes
    - Boost.Config Feature Check: cxx11_auto_declarations : yes
    - Boost.Config Feature Check: cxx11_constexpr : yes
    - Boost.Config Feature Check: cxx11_defaulted_functions : yes
    - Boost.Config Feature Check: cxx11_final : yes
    - Boost.Config Feature Check: cxx11_hdr_mutex : yes
    - Boost.Config Feature Check: cxx11_hdr_tuple : yes
    - Boost.Config Feature Check: cxx11_lambdas : yes
    - Boost.Config Feature Check: cxx11_noexcept : yes
    - Boost.Config Feature Check: cxx11_nullptr : yes
    - Boost.Config Feature Check: cxx11_rvalue_references : yes
    - Boost.Config Feature Check: cxx11_template_aliases : yes
    - Boost.Config Feature Check: cxx11_thread_local : yes
    - Boost.Config Feature Check: cxx11_variadic_templates : yes
    - has_icu builds           : no
warning: Graph library does not contain MPI-based parallel components.
note: to enable them, add "using mpi ;" to your user-config.jam
    - zlib                     : no
    - bzip2                    : no
    - lzma                     : no
    - zstd                     : no
    - iconv (libc)             : no
    - iconv (separate)         : no
    - icu                      : no
    - icu (lib64)              : no
    - native-atomic-int32-supported : yes
    - message-compiler         : yes
    - native-syslog-supported  : no
    - pthread-supports-robust-mutexes : no
    - compiler-supports-ssse3  : yes
    - compiler-supports-avx2   : yes
    - gcc visibility           : no
    - long double support      : yes
warning: skipping optional Message Passing Interface (MPI) library.
note: to enable MPI support, add "using mpi ;" to user-config.jam.
note: to suppress this message, pass "--without-mpi" to bjam.
note: otherwise, you can safely ignore this message.
    - libbacktrace builds      : no
    - addr2line builds         : no
    - WinDbg builds            : yes
    - WinDbgCached builds      : yes
    - BOOST_COMP_GNUC >= 4.3.0 : no
    - zlib                     : no  (cached)
    - bzip2                    : no  (cached)
    - lzma                     : no  (cached)
    - zstd                     : no  (cached)
    - C++11 mutex              : yes
    - Boost.Config Feature Check: cxx11_auto_declarations : yes
    - Boost.Config Feature Check: cxx11_constexpr : yes
    - Boost.Config Feature Check: cxx11_defaulted_functions : yes
    - Boost.Config Feature Check: cxx11_final : yes
    - Boost.Config Feature Check: cxx11_hdr_mutex : yes
    - Boost.Config Feature Check: cxx11_hdr_tuple : yes
    - Boost.Config Feature Check: cxx11_lambdas : yes
    - Boost.Config Feature Check: cxx11_noexcept : yes
    - Boost.Config Feature Check: cxx11_nullptr : yes
    - Boost.Config Feature Check: cxx11_rvalue_references : yes
    - Boost.Config Feature Check: cxx11_template_aliases : yes
    - Boost.Config Feature Check: cxx11_thread_local : yes
    - Boost.Config Feature Check: cxx11_variadic_templates : yes
    - has_icu builds           : no
    - zlib                     : no
    - bzip2                    : no
    - lzma                     : no
    - zstd                     : no
    - iconv (libc)             : no
    - iconv (separate)         : no
    - icu                      : no
    - icu (lib64)              : no
    - native-atomic-int32-supported : yes
    - message-compiler         : yes
    - native-syslog-supported  : no
    - pthread-supports-robust-mutexes : no
    - compiler-supports-ssse3  : yes
    - compiler-supports-avx2   : yes
    - gcc visibility           : no
    - long double support      : yes
    - libbacktrace builds      : no
    - addr2line builds         : no
    - WinDbg builds            : yes
    - WinDbgCached builds      : yes
    - BOOST_COMP_GNUC >= 4.3.0 : no
    - zlib                     : no  (cached)
    - bzip2                    : no  (cached)
    - lzma                     : no  (cached)
    - zstd                     : no  (cached)

Component configuration:

    - atomic                   : building
    - chrono                   : building
    - container                : building
    - context                  : building
    - contract                 : building
    - coroutine                : building
    - date_time                : building
    - exception                : building
    - fiber                    : building
    - filesystem               : building
    - graph                    : building
    - graph_parallel           : building
    - headers                  : building
    - iostreams                : building
    - locale                   : building
    - log                      : building
    - math                     : building
    - mpi                      : building
    - program_options          : building
    - python                   : building
    - random                   : building
    - regex                    : building
    - serialization            : building
    - stacktrace               : building
    - system                   : building
    - test                     : building
    - thread                   : building
    - timer                    : building
    - type_erasure             : building
    - wave                     : building

...patience...
...patience...
...patience...
...patience...
...patience...
...found 26874 targets...
...updating 2407 targets...
compile-c-c++ bin.v2\libs\python\build\msvc-14.2\debug\link-static\python-3.7\threading-multi\list.obj
list.cpp
...
...
...
中间过程省略,赶时间比较久,大概要半个小时。。。
...
...
...updated 2407 targets...


The Boost C++ Libraries were successfully built!

The following directory should be added to compiler include paths:

    C:\boost_1_70_0

The following directory should be added to linker library paths:

    C:\boost_1_70_0\stage\lib


接着执行bjam.exe

C:\boost_1_70_0>bjam.exe
Performing configuration checks

    - default address-model    : 32-bit (cached)
    - default architecture     : x86 (cached)

Building the Boost C++ Libraries.


    - C++11 mutex              : yes (cached)
    - Boost.Config Feature Check: cxx11_auto_declarations : yes (cached)
    - Boost.Config Feature Check: cxx11_constexpr : yes (cached)
    - Boost.Config Feature Check: cxx11_defaulted_functions : yes (cached)
    - Boost.Config Feature Check: cxx11_final : yes (cached)
    - Boost.Config Feature Check: cxx11_hdr_mutex : yes (cached)
    - Boost.Config Feature Check: cxx11_hdr_tuple : yes (cached)
    - Boost.Config Feature Check: cxx11_lambdas : yes (cached)
    - Boost.Config Feature Check: cxx11_noexcept : yes (cached)
    - Boost.Config Feature Check: cxx11_nullptr : yes (cached)
    - Boost.Config Feature Check: cxx11_rvalue_references : yes (cached)
    - Boost.Config Feature Check: cxx11_template_aliases : yes (cached)
    - Boost.Config Feature Check: cxx11_thread_local : yes (cached)
    - Boost.Config Feature Check: cxx11_variadic_templates : yes (cached)
    - has_icu builds           : no  (cached)
warning: Graph library does not contain MPI-based parallel components.
note: to enable them, add "using mpi ;" to your user-config.jam
    - zlib                     : no  (cached)
    - bzip2                    : no  (cached)
    - lzma                     : no  (cached)
    - zstd                     : no  (cached)
    - iconv (libc)             : no  (cached)
    - iconv (separate)         : no  (cached)
    - icu                      : no  (cached)
    - icu (lib64)              : no  (cached)
    - native-atomic-int32-supported : yes (cached)
    - message-compiler         : yes (cached)
    - native-syslog-supported  : no  (cached)
    - pthread-supports-robust-mutexes : no  (cached)
    - compiler-supports-ssse3  : yes (cached)
    - compiler-supports-avx2   : yes (cached)
    - gcc visibility           : no  (cached)
    - long double support      : yes (cached)
warning: skipping optional Message Passing Interface (MPI) library.
note: to enable MPI support, add "using mpi ;" to user-config.jam.
note: to suppress this message, pass "--without-mpi" to bjam.
note: otherwise, you can safely ignore this message.
    - libbacktrace builds      : no  (cached)
    - addr2line builds         : no  (cached)
    - WinDbg builds            : yes (cached)
    - WinDbgCached builds      : yes (cached)
    - BOOST_COMP_GNUC >= 4.3.0 : no  (cached)
    - zlib                     : no  (cached)
    - bzip2                    : no  (cached)
    - lzma                     : no  (cached)
    - zstd                     : no  (cached)
    - C++11 mutex              : yes (cached)
    - Boost.Config Feature Check: cxx11_auto_declarations : yes (cached)
    - Boost.Config Feature Check: cxx11_constexpr : yes (cached)
    - Boost.Config Feature Check: cxx11_defaulted_functions : yes (cached)
    - Boost.Config Feature Check: cxx11_final : yes (cached)
    - Boost.Config Feature Check: cxx11_hdr_mutex : yes (cached)
    - Boost.Config Feature Check: cxx11_hdr_tuple : yes (cached)
    - Boost.Config Feature Check: cxx11_lambdas : yes (cached)
    - Boost.Config Feature Check: cxx11_noexcept : yes (cached)
    - Boost.Config Feature Check: cxx11_nullptr : yes (cached)
    - Boost.Config Feature Check: cxx11_rvalue_references : yes (cached)
    - Boost.Config Feature Check: cxx11_template_aliases : yes (cached)
    - Boost.Config Feature Check: cxx11_thread_local : yes (cached)
    - Boost.Config Feature Check: cxx11_variadic_templates : yes (cached)
    - has_icu builds           : no  (cached)
    - zlib                     : no  (cached)
    - bzip2                    : no  (cached)
    - lzma                     : no  (cached)
    - zstd                     : no  (cached)
    - iconv (libc)             : no  (cached)
    - iconv (separate)         : no  (cached)
    - icu                      : no  (cached)
    - icu (lib64)              : no  (cached)
    - native-atomic-int32-supported : yes (cached)
    - message-compiler         : yes (cached)
    - native-syslog-supported  : no  (cached)
    - pthread-supports-robust-mutexes : no  (cached)
    - compiler-supports-ssse3  : yes (cached)
    - compiler-supports-avx2   : yes (cached)
    - gcc visibility           : no  (cached)
    - long double support      : yes (cached)
    - libbacktrace builds      : no  (cached)
    - addr2line builds         : no  (cached)
    - WinDbg builds            : yes (cached)
    - WinDbgCached builds      : yes (cached)
    - BOOST_COMP_GNUC >= 4.3.0 : no  (cached)
    - zlib                     : no  (cached)
    - bzip2                    : no  (cached)
    - lzma                     : no  (cached)
    - zstd                     : no  (cached)

Component configuration:

    - atomic                   : building
    - chrono                   : building
    - container                : building
    - context                  : building
    - contract                 : building
    - coroutine                : building
    - date_time                : building
    - exception                : building
    - fiber                    : building
    - filesystem               : building
    - graph                    : building
    - graph_parallel           : building
    - headers                  : building
    - iostreams                : building
    - locale                   : building
    - log                      : building
    - math                     : building
    - mpi                      : building
    - program_options          : building
    - python                   : building
    - random                   : building
    - regex                    : building
    - serialization            : building
    - stacktrace               : building
    - system                   : building
    - test                     : building
    - thread                   : building
    - timer                    : building
    - type_erasure             : building
    - wave                     : building

...patience...
...patience...
...patience...
...patience...
...patience...
...patience...
...found 27172 targets...


The Boost C++ Libraries were successfully built!

The following directory should be added to compiler include paths:

    C:\boost_1_70_0

The following directory should be added to linker library paths:

    C:\boost_1_70_0\stage\lib

需要添加C:\boost_1_70_0C:\boost_1_70_0\stage\lib到VS 2019工程文件中。

添加boost 1.7.0库到VS 2019工程

进行以下设置:

  • Configuration Properties > C/C++ > Precompiled Headers. 设置Not Using Precompiled Headers(不知道这个有没有用)

  • Set the “General > Platform Toolset” to Visual Studio 2019 (v142).

  • 设置"General > C Language Standard" to ISO C11 Standard (/std:c11) (不知道这个有没有用)

  • Include the path to the boost folder (e.g. C:\boost_1_70_0) and the path to the subfolder containing the binary files (e.g. C:\boost_1_70_0\stage\lib) in:“C\C++ > Additional Include Directory” and “Linker > Additional Library Directories”.

编译问题

参见Why does Visual Studio 2013 error on C4996?, 对于C4996的问题,进行以下设置解决:
Apparently new projects enable “SDK check” by default now, which treats these warnings as errors. To disable it, go to project properties -> Configuration Properties -> C/C++ -> General -> SDL checks -> No.

参考

vs2015 安装boost库
C++ problem: boost/asio.hpp non existing
https://www.boost.org/users/history/version_1_70_0.html
How to add boost library 1_65 or 1_64 to Visual Studio 2017 project?
Compiler Error C2664
Why does Visual Studio 2013 error on C4996?
Having problems with Boost library and Visual Studio (C++)
fatal error LNK1104: cannot open file ‘libboost_system-vc110-mt-gd-1_51.lib’
Building Boost.Build engine ‘cl’ is not recognized as an internal or external command, operable program or batch file
how to install boost correctly
Error “fatal error C1034: windows.h: no include path set”文章来源地址https://www.toymoban.com/news/detail-485819.html

到了这里,关于Visual Studio 2019安装boost 1.7.0库的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • (二)Visual Studio 2019安装.Net 5

    最开始我用的.Net core 3.1版本去写项目,写到一半发现,我要引用一个NuGet包,然后报错说只支持.Net 5.0版本。 那时我就好奇.Net core和.Net 之间的区别,好家伙,网上一大堆,然后我get不到他们的意思,我当时完全是脑子糊掉了状态。后面也是去找Net的历史才知道,可以看看我

    2023年04月08日
    浏览(80)
  • Visual Studio 2019 详细安装教程(图文版)

    Visual Studio 2019 安装包的下载教程、安装教程 教程 博主博客链接:https://blog.csdn.net/m0_74014525 关注博主,后期持续更新系列文章 ********文章附有百度网盘安装包链接********* 第一篇:Visual Studio 2019 详细安装教程(图文版) 第二篇:Visual Studio 2019 实用功能设置(背景颜色,代码

    2024年02月08日
    浏览(53)
  • Visual Studio 2019安装打包工具使用教程

    打开Visual Studio 2019,工具 -- 扩展和更新 -- 联机 -- 搜索 -- Microsoft Visual Studio Installer Projects --下载 关闭Microsoft Visual Studio,弹出VSIX Installer窗口中,点击“修改”或“Modify”后进行安装 注意:这里Microsoft Visual Studio若还在运行,则会提示关掉后才可以修改(若找不到对应的,在

    2024年02月07日
    浏览(41)
  • Visual Studio 2019离线安装包获取和安装教程

    摘要 介绍Visual Studio 2019离线安装方法和配置及注意事项 VS2019 离线安装 Visual Studio 2019版本与以往的2015、2013、2012版本不同,采用了新的模块化安装方法。微软官方也并未提供ISO镜像,根据官方提供的离线下载方案(docs.microsoft.com/en-us/visua… Studio的脱机安装说明。 一、

    2024年02月05日
    浏览(35)
  • visual studio 2019安装Nsight无菜单项

    visual studio 2019 community版 nsight visual studio edition 最新版(2022.1)安装后无法找到nsight的菜单 解决的办法: 到这个连接去下载 Nsight Developer Tools Integration, 或者从vs 2019的扩展菜单里找到在线搜索nsight安装,然后就可以在扩展里面看到了。 https://marketplace.visualstudio.com/items?itemNa

    2024年02月08日
    浏览(34)
  • 你好visual studio 2019:关于vs2019的安装和疑难杂症

    目录 一.Visual Studio 2019安装方法 二.Visual Studio 2019的基础操作 ①.新建项目 ②.调整Visual Studio 主题颜色 ③.调整Visual Studio 字体 ④.Visual Studio 字体选择 三.关于#define_CRT_SECURE_NO_WARNINGS问  1.首先打开window自带的Microsoft Store Microsoft Store 也就是俗称的微软商城。 2.在Microsoft Store的搜

    2024年02月10日
    浏览(36)
  • Visual Studio 2019安装vsix插件及Gitee.VisualStudio安装包

    网上安装 Gitee.VisualStudio插件 速度较慢,可以从百度网盘下载 链接:https://pan.baidu.com/s/16WLjWHMTMUSRfyt_SKxFWA?pwd=74cd 提取码:74cd 下载成功之后,是一个后缀名为vsix的文件 win+R打开运行,输入“cmd” 如果Visual Studio 2019是装在别的盘里,那么需要先切换路径,我是装在了D盘,步骤

    2024年02月11日
    浏览(33)
  • Visual Studio 2019 安装教程 & 安装后继续安装其它模块组件功能扩展包

    Visual Studio分为社区版、专业版、企业版,3个版本,社区版无需激活码   Visual Studio 2019 下载地址 https://my.visualstudio.com/Downloads?q=Visual%20Studio%202019 Visual Studio 2019 Enterprise(企业版) 序列号/激活码 BF8Y8-GN2QH-T84XB-QV

    2024年02月06日
    浏览(29)
  • MySQL msi安装缺少‘Microsoft Visual Studio 2019 Redistributable’

    下载好msi文件运行报错,提示未安装‘Microsoft Visual Studio 2019 Redistributable’ 点击这里 点击最底部: Other Tools and Frameworks 一栏, 下载 Microsoft Visual C++ Redistributable for Visual Studio 2019 并安装,重启电脑后再运行MySQL安装程序即可。

    2024年02月13日
    浏览(38)
  • 【UE4 C++】01-Visual Studio 2019社区版安装

    目录 步骤 一、下载安装包 二、安装  一、下载安装包 官网目前Visual Studio是2022版本,我们需要下载Visual Studio老版本: Visual Studio 较旧的下载 - 2019、2017、2015 和以前的版本   二、安装  双击运行安装包后,在打开的界面勾选“使用C++的桌面开发”  勾选“使用C++的游戏开发

    2024年02月13日
    浏览(31)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包