我已经在 Visual Studio 2019 中为 Windows 创建了一个简单的 C++ 控制台应用程序,我希望它能够在 Windows 8(不是 8.1)机器上运行。
我已经从Microsoft 的 Windows SDK Archive下载并安装了 Windows 8 SDK 。我可以看到它显然与 8.1 和 10 SDK 一起安装:
现在,当我转到 Visual Studio 中的项目属性时,我没有选择 Windows 8 SDK 的选项:
我尝试在 Windows SDK 版本中手动输入“8.0”,然后将所有内容指向 Windows 8 SDK 目录:
但在编译时我得到:
Error (active) E1696 cannot open source file "stddef.h"
Error (active) E1696 cannot open source file "stdio.h"
Error (active) E1696 cannot open source file "math.h"
(...lots of similar errors...)
Error MSB8036 The Windows SDK version 8.0 was not found. Install the required version of Windows SDK or change the SDK version in the project property pages or by right-clicking the solution and selecting "Retarget solution".
您不需要安装旧的 Windows SDK。安装支持 Windows 7 以上目标的最新版就足够了。
您不应该选择 Windows SDK 版本,而应该使用C/C++ -> 预处理器中的宏指定目标平台: