Mah*_*vcs 4 c++ windows-xp visual-c++ visual-studio-2013
在我的应用程序中,我需要检查Windows版本.我使用的版本辅助功能在Visual Studio 2013 (v120) platform toolset.但是该程序在Windows XP中不起作用.错误是:
'xxx.exe' is not a valid win32 application
Run Code Online (Sandbox Code Playgroud)
所以我将平台工具集更改为Visual Studio 2013 - Windows XP (v120_xp).但在这种情况下,应用程序将无法编译.错误是:
error C1083: Cannot open include file: 'VersionHelpers.h': No such file or directory
Run Code Online (Sandbox Code Playgroud)
我能做什么?我可以使用旧的GetVersionEx功能吗?MSDN说:
GetVersionEx may be altered or unavailable for releases after Windows 8.1. Instead, use the Version Helper APIs
Run Code Online (Sandbox Code Playgroud)
但也许我现在应该用它!
Mah*_*vcs 10
我已经设法使用Remmy Lebeau的评论解决了这个问题.
我复制VersionHelpers.h的C:\Program Files (x86)\Windows Kits\8.1\Include\um,并winapifamily.h和sdkddkver.h来自C:\Program Files (x86)\Windows Kits\8.1\Include\shared到我的项目,改变了一些包括在其中.
现在它使用Windows XP工具集进行编译.
我已经测试了它,它在所有版本的Windows中都按预期工作.