如何在Windows 7 64位上安装vcpkg?

问题描述

我试图将一些Linux C代码导入Windows。我使用的编辑器是Visual Studio Code,但是#include无法正常工作。

可能的解决方案是安装 vcpkg 来管理缺少的库并包含文件。我从https://github.com/microsoft/vcpkg下载了vcpkg安装软件包。然后,我在cmd.exe中运行bootstrap-vcpkg.bat。错误是:

C:\study\vcpkg\vcpkg-master\toolsrc\windows-bootstrap\vcpkg.vcxproj(25,3): error MSB4019: The imported project “C:\Program Files (x86)\Microsoft Visual Studio\2019
\Community\MSBuild\Microsoft\VC\v160\Microsoft.Cpp.Default.props” was not found. Confirm that the path “C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\\Microsoft.Cpp.Default.props” declaration is correct,and that the file exists on disk.
Write-Error : Building vcpkg.exe Failed. Please ensure you have installed Visual Studio with the Desktop C++ workload and the Windows SDK for Desktop C++.
所在位置 C:\study\vcpkg\vcpkg-master\scripts\bootstrap.ps1:410 字符: 16+     Write-Error <<<<  "Building vcpkg.exe Failed. Please ensure you have inst
alled Visual Studio with the Desktop C++ workload and the Windows SDK for Desktop C++." + CategoryInfo: NotSpecified: (:) [Write-Error],WriteErrorException + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Microsoft.PowerShell.Commands.WriteErrorCommand ScriptHalted
所在位置 C:\study\vcpkg\vcpkg-master\scripts\bootstrap.ps1:411 字符: 10 + throw <<<< + CategoryInfo : OperationStopped: (:) [],RuntimeException + FullyQualifiedErrorId : ScriptHalted

如描述的那样,找不到Microsoft.Cpp.Default.props。因此,我尝试将Visual Studio 2019社区安装为Google的一些答案。安装后,我重试了上述步骤。但是会发生同样的错误

有人可以帮助解决这个问题吗?我想我可能会错过Visual Studio Code的某些设置或软件包。

解决方法

bootstrap-vcpkg.bat需要Visual Studio才能创建vcpkg.exe。

您确定Visual Studio已安装在系统中吗?

vcpkg需要:

  1. 带有桌面C ++工作负载的Visual Studio
  2. 用于桌面C ++的Windows SDK(例如,Windows SDK 8.1或更高版本)