Windows 10 上的 Windows SDK 是否与 Windows XP 及更低版本不兼容?

Is the Windows SDK on Windows 10 not compatible with Windows XP and lower?

我尝试了 运行 一个显示 window 的基本 C++ 应用程序。它使用的 API 功能与 Windows XP 兼容,但应用程序本身不会 运行 在我的 Windows XP VM 上。

它是在 Windows 10 上编译的,一些谷歌搜索向我展示了这里的一个答案,说 Windows 10 SDK 与 Windows XP 或更低版本不兼容。

这是为什么?原型和函数名不都一样吗?

如果不是,我应该使用哪个 SDK 才能全面兼容?

如果您正在使用 Visual Studio,前段时间默认平台工具集放弃了 Windows XP 支持。您可以从菜单 Project->project name Properties... 然后 Configuration properties->General->Platform toolset 切换到另一个平台工具集。您可以在那里更改用于当前项目的工具集

但是无法安装 XP 工具集。

Configuring Programs for Windows XP

Install the Windows XP platform toolset

To get the v141_xp platform toolset and components to target Windows XP and Windows Server 2003, run the Visual Studio Installer. When you initially install Visual Studio, or when you modify an existing installation, make sure the Desktop development with C++ workload is selected. In the Individual components tab, under Compilers, build tools, and runtimes, choose C++ Windows XP Support for VS 2017 (v141) tools [Deprecated], and then choose Install or Modify.