如何在Windows 10中安装Boost与VS 2019预览版

inb24sb2  于 2023-02-16  发布在  Windows
关注(0)|答案(2)|浏览(163)

我搜索了很多,但我没有找到任何有用的分步指南来安装和配置和构建Windows 10中的提升VS 2019预览版。你们中的任何人可以指导我完成这项任务吗?
我已经下载了boost 1.70,但当我执行bootstrap.bat时,它给出了以下消息:

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

Failed to build Boost.Build engine.
Please consult bootstrap.log for further diagnostics.

C:\libraries\boost\boost_1_70_0>

此文件本身具有以下文本:

c:\libraries\boost\boost_1_70_0\tools\build\src\engine>if exist bootstrap rd /S /Q bootstrap 

c:\libraries\boost\boost_1_70_0\tools\build\src\engine>md bootstrap 

c:\libraries\boost\boost_1_70_0\tools\build\src\engine>cl /nologo /RTC1 /Zi /MTd /Fobootstrap/ /Fdbootstrap/ -DNT -DYYDEBUG -wd4996 kernel32.lib advapi32.lib user32.lib /Febootstrap\jam0  command.c compile.c constants.c debug.c execcmd.c execnt.c filent.c frames.c function.c glob.c hash.c hdrmacro.c headers.c jam.c jambase.c jamgram.c lists.c make.c make1.c object.c option.c output.c parse.c pathnt.c pathsys.c regexp.c rules.c scan.c search.c subst.c timestamp.c variable.c modules.c strings.c filesys.c builtins.c md5.c class.c cwd.c w32_getreg.c native.c modules/set.c modules/path.c modules/regex.c modules/property-set.c modules/sequence.c modules/order.c 
command.c
compile.c
constants.c
debug.c
execcmd.c
execnt.c
filent.c
frames.c
function.c
glob.c
hash.c
hdrmacro.c
headers.c
jam.c
jambase.c
jamgram.c
lists.c
make.c
make1.c
object.c
Generating Code...
Compiling...
option.c
output.c
parse.c
pathnt.c
pathsys.c
regexp.c
rules.c
scan.c
search.c
subst.c
timestamp.c
variable.c
modules.c
strings.c
filesys.c
builtins.c
md5.c
class.c
cwd.c
w32_getreg.c
Generating Code...
Compiling...
native.c
set.c
path.c
regex.c
property-set.c
sequence.c
order.c
Generating Code...

当我尝试boost 1.68时,我可以成功运行bootstrap.bat,但当我执行b2.exe时,它给我以下消息:

warning: Did not find command for MSVC toolset. If you have Visual Studio 2017 installed you will need to specify the full path to the command, set VS150COMNTOOLS for your installation, or build from the 'Visual Studio Command Prompt for VS 2017'.
tyky79it

tyky79it1#

你目前不能用 * Preview * 构建Boost,但你可以用刚刚发布的常规2019。我也遇到过同样的问题。安装2019常规所需的功能需要十分钟。你可以同时拥有这两个功能。
为了将来参考,这里是我关于如何在具有MPI和Python支持的Windows上构建boost的注解。

使用VS 2019在Windows上构建Boost

需要Visual Studio 2019非预览版,任何版本,所有的C++和Windows SDK的东西。

  • 注意:如果同时安装了C++和Windows SDK,请暂时从VS Preview中卸载。理想情况下,系统上只有一个编译器,这样Boost.build就不会混淆。*

接下来,假设您已经安装了git-for-windows,执行

git clone https://github.com/boostorg/boost.git --recursive

boost超级项目repo到一个名为/Boost/的未受保护的文件夹(必须是未受保护的!)

cd boost

现在你在/Boost/boost中了。查看开发者分支(获取最新更新)

git checkout develop -f

其中-f强制更新。
使用Visual Studio开发人员控制台在boost文件夹中运行 Bootstrap 。若要激活此控制台,请使用Windows搜索栏 "在此处键入以搜索" 查找"开发人员命令提示符",或打开Visual Studio并使用顶部的搜索栏。

  • 注意:如果出现访问错误,则必须激活管理Visual Studio开发人员控制台。在管理模式下打开cmd,然后运行激活Visual Studio开发人员控制台的文件VsDevCmd.bat。*
bootstrap

如果您尚未安装Microsoft MPI,请通过安装最新版本的Microsoft MPI可用的两个文件来安装Microsoft MPI。已知使用Version 10时,需要将SDK(. msi文件)和非SDK(. exe文件)文件都安装到默认位置。请勿修改这些位置。
然后将/Boost/boost/目录中的project-config.jam修改为以下内容:
(btw,每行后有空白[一个规则的空格],甚至空行)

# Boost.Build Configuration 
# Automatically generated by bootstrap.bat 
 
import option ; 
 
#latest toolset by default 
using msvc ; 

#in case you specified a toolset with bootstrap 
#using msvc: 14.2; 

option.set keep-going : false ; 
 
using python ; 
 
using mpi ;

最后两行假设您需要mpi和python支持。
现在打开Visual Studio开发人员控制台并导航(cd)到boost文件夹/Boost/boost。由于我们使用的是VS 2019中的Visual C++编译器,显然我们不需要执行任何b2 install操作(请参见入门指南中的5.1 - 5.2节)。

b2 -j8 --address-model=64

选项包括

  • --toolset=14.xx [指定vs编译器版本14.15等](或者toolset没有--,有人告诉我,不确定哪个是正确的,请告诉我,对我来说是--。如果你运行bootstrap vc14x就不需要了)
  • -a用于全部重建
  • -j8,用于8核编译
  • --address-model=64(或address-model,不带--,有人告诉我,不确定哪个是正确的,请告诉我,对我来说是--)用于64位
  • > my_log.txt,以记录构建输出的大量文本,供以后使用(确保运行正常)。
uqjltbpv

uqjltbpv2#

我怀疑您 * 不是 * 在Visual Studio tools Command Prompt窗口中构建boost
请看我在这里给出的答案:如何使用地址模型标志为windows上的visual studio构建64位增强?以及这里如何在64位中构建Boost 1.64?

相关问题