【问题标题】:Can't build with v141_xp toolset (can't install v7.1A SDK)无法使用 v141_xp 工具集构建(无法安装 v7.1A SDK)
【发布时间】:2018-08-24 21:42:37
【问题描述】:

VS 在使用 v141 工具集和 Windows 10 SDK 进行编译时工作正常,但在我切换到 v141_xp 工具集和 Windows 7.0 SDK 并点击 Build 时它会中断。 重要提示:v141_xp 工具集曾经在大约半年前工作。当时我已经在这台机器上安装了 2010 年到 2017 年的所有 Visual Studio 软件。然后我决定删除所有这些,除了 2017 年。我不知道在那之后 XP 工具集是否坏了,因为从那以后我没有使用它.

一些默认项目的示例输出:

1>------ Build started: Project: Project1, Configuration: Debug Win32 ------
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Platforms\Win32\PlatformToolsets\v141_xp\Toolset.targets(36,5): warning MSB8003: Could not find WindowsSdkDir_71A variable from the registry.  TargetFrameworkVersion or PlatformToolset may be set to an invalid version number.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(375,5): warning MSB8003: Could not find WindowsSDKDir variable from the registry.  TargetFrameworkVersion or PlatformToolset may be set to an invalid version number.
1>Project1.cpp
1>LINK : fatal error LNK1104: cannot open file 'kernel32.lib'
1>Done building project "Project1.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

如果我删除 XP 支持,安装程序会通知我将释放 220MB,但如果我选择重新安装它,则说“所需的总空间”为 507KB,这令人怀疑。 此外,每当我选择安装 XP 支持时,都会创建 C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A,但它仍然为空。

有时,即使安装了 XP 支持,当我加载 XP vcxproj 时,此消息也会打印 2 次:

Project 'Project1' could not be loaded because it's missing install components. To fix this launch Visual Studio installer with the following selections:
Windows XP support for C++

安装缺少的功能不会修复它,甚至无法重新安装整个 VS。

【问题讨论】:

    标签: windows visual-studio sdk visual-studio-2017


    【解决方案1】:

    这让我难过了一阵子。我尝试重新安装 XP 构建工具,修复 VS 安装本身等。我最终通过以下方式解决了这个问题:

    1. 打开 VS 2017 安装程序(工具菜单 -> 获取工具和功能)
    2. 选择“单个组件”选项卡
    3. 向下滚动到“编译器、构建工具和运行时”部分
    4. 选中“Windows XP 对 C++ 的支持”(在该部分的底部)。

    这神奇地使之前安装的 _xp 工具链可以找到 SDK。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-09-06
      • 2015-08-20
      • 2021-05-27
      • 1970-01-01
      • 2018-05-16
      • 1970-01-01
      • 1970-01-01
      • 2018-04-10
      相关资源
      最近更新 更多