将Boost添加到VS2017项目中

编程入门 行业动态 更新时间:2024-10-26 22:22:44
本文介绍了将Boost添加到VS2017项目中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使用boost更新从C到C ++的程序。我无法获得#include< boost \whatever.hpp>并使用boost作为命名空间来工作。

我进入了附加包含目录和其他#using目录并添加了boost的路径,但它仍然无法识别该目录。 / p>

有什么建议吗?

谢谢。

解决方案

亲爱的朋友,

感谢您的发帖。

我可以问你身边的Boost版本吗?

Boost 1.63 不支持完全支持VS2017 ,但你可以欺骗它找到VC ++ 2017编译器:

  • 运行 bootstrap.bat boost目录
  • 更新项目-config.jam包括: 使用 msvc:14.0:<路径x86或x64 cl.exe> 。应该是 " c:\Program Files(x86)\ Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.24911\ bin \HostX64 \ x64 \ cl.exe"
  • 从Windows开始菜单运行"VS 2017 RC的开发人员命令提示符"到使用x86 vcvars或x64 vcvars。
  • 运行 b2 toolset = msvc-14.0 。在x64版本中,添加 address-model = 64 到 b2命令行。
  • ;

    Boost 1.64 , 应支持VS2017:

    运行" x86 Native Tools命令从开始菜单提示VS 2017"或"x 2017 Native Tools Command Prompt for VS 2017",而不是在命令提示符内运行 b2 :

    32位: b2 toolset = msvc-14.1 --build-dir = .x86 --stagedir = stage_x86

    64 -bit: b2 toolset = msvc-14.1 address-model = 64 --build-dir = .x64 --stagedir = stage_x64

    添加 link = shared 到构建共享库

    希望它有所帮助。

    祝你好运,

    Fletcher

    Hi,

    I'm updating a program from C to C++ that is using boost. I am having trouble getting the #include <boost\whatever.hpp> and using boost as a namespace to work.

    I went into the Additional Include Directories and Additional #using Directories and added the path for boost, but it still doesn't recognize the directory.

    Any suggestions?

    Thanks.

    解决方案

    Dear friend,

    Thanks for your posting.

    May I ask the version of Boost in your side?

    For Boost 1.63 which doesn't fully support VS2017, but you can trick it to find VC++2017 compiler:

  • Runbootstrap.batin boost directory
  • Update the project-config.jam to include:using msvc : 14.0 : <path to x86 or x64 cl.exe>. Should be something like"c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.24911\bin\HostX64\x64\cl.exe"
  • Run "Developer Command Prompt for VS 2017 RC" from Windows Start Menu to boostrap from a shell configured using the x86 vcvars or x64 vcvars.
  • Runb2 toolset=msvc-14.0in that command prompt. For the x64 build, addaddress-model=64to the b2 command line.
  • For Boost 1.64,it should support VS2017:

    Run "x86 Native Tools Command Prompt for VS 2017" or "x64 Native Tools Command Prompt for VS 2017" from Start Menu, than inside command prompt runb2:

    32-bit:b2 toolset=msvc-14.1 --build-dir=.x86 --stagedir=stage_x86

    64-bit:b2 toolset=msvc-14.1 address-model=64 --build-dir=.x64 --stagedir=stage_x64

    Addlink=sharedto build shared libraries

    Hope it helps.

    Best regards,

    Fletcher

    更多推荐

    将Boost添加到VS2017项目中

    本文发布于:2023-11-06 17:44:30,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1564365.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:项目   Boost

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!