将Boost添加到VS2017项目中 [英] Adding Boost to a VS2017 project
问题描述
我正在使用boost更新从C到C ++的程序。我无法获得#include< boost \whatever.hpp>并使用boost作为命名空间来工作。
我进入了附加包含目录和其他#using目录并添加了boost的路径,但它仍然无法识别该目录。 / p>
有什么建议吗?
谢谢。
亲爱的朋友,
感谢您的发帖。
我可以问你身边的Boost版本吗?
Boost 1.63 不支持完全支持VS2017 ,但你可以欺骗它找到VC ++ 2017编译器:
- 运行 < 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目录- 更新项目-config.jam包括:
使用
。应该是 < 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
msvc:14.0:<路径x86或x64 cl.exe>
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
。在x64版本中,添加
toolset = msvc-14.0address-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:
- Run
bootstrap.bat
in 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.
- Run
b2 toolset=msvc-14.0
in that command prompt. For the x64 build, addaddress-model=64
to 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 librariesHope it helps.
Best regards,
Fletcher
这篇关于将Boost添加到VS2017项目中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!