将Boost添加到VS2017项目中 [英] Adding Boost to a VS2017 project

查看:155
本文介绍了将Boost添加到VS2017项目中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


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


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

有什么建议吗?


谢谢。

解决方案

亲爱的朋友,


感谢您的发帖。


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


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


  1. 运行  < code style ="margin:0px; padding:1px 5px; border:0px currentColor; line-height:inherit; font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono', 'Bitstream Vera Sans Mono','Courier New',monospace,sans-serif; font-size:13px; font-style:inherit; font-variant:inherit; font-weight:inherit; vertical-align:baseline; white- space:pre-wrap; background-color:#eff0f1"> bootstrap.bat  
    boost目录
  2. 更新项目-config.jam包括:  使用
    msvc:14.0:<路径x86或x64 cl.exe>
    。应该是  < code style ="margin:0px;填充:1px 5px; border:0px currentColor;行高:继承; font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif;字体大小:13像素;字体风格:继承;字体变:继承;字体重量:继承;垂直对齐:基线;空白:预缠绕; background-color:#eff0f1">" c:\Program
    Files(x86)\ Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.24911\ bin \HostX64 \ x64 \ cl.exe"
  3. 从Windows开始菜单运行"VS 2017 RC的开发人员命令提示符"到使用x86 vcvars或x64 vcvars。
  4. 运行  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:

  1. Run bootstrap.bat in boost directory
  2. 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"
  3. 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.
  4. Run b2 toolset=msvc-14.0 in that command prompt. For the x64 build, add address-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 run b2:

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

Add link=shared to build shared libraries

Hope it helps.

Best regards,

Fletcher


这篇关于将Boost添加到VS2017项目中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆