Cannot open include file: 'VersionHelpers.h

2020-03-12 06:41发布

I'm trying to use IsWindows7SP1OrGreater function, declared in VersionHelpers.h header. And I get:

'VersionHelpers.h': No such file or directory

although I can open this header from Visual Studio, it is found by syntax checker correctly. What's the problem?

3条回答
叼着烟拽天下
2楼-- · 2020-03-12 07:08

Yeah... Its right that VersionHelpers.h included in the VS2013 Windows 8.1 SDK.

For those using VS2012, you will have to redownload the Win 8.1 SDK and install it. Navigate to the Program Files(x86)\Windows Kits\8.1\Include\um. Copy all files and paste into 8.0\Include\um . Its better to skip all existing files. Reload VS

查看更多
我欲成王,谁敢阻挡
3楼-- · 2020-03-12 07:16

In order to use the version helpers macros, you need to be targetting the v120 platform toolset this ships with VS 2013. If you create a an empty project in VS 2013 then you will find that an include of VersionHelpers.h works fine.

If you are targetting v120 then I guess something else is misconfigured in your project. Start with a brand new project and convince yourself that #include <VersionHelpers.h> works as expected. Then try to find out what's different between your troublesome project, and the plain vanilla project that works.

查看更多
贪生不怕死
4楼-- · 2020-03-12 07:25

I had that problem myself, and I couldn't find the file anywhere on my disk.

Then I just realized the file seems to be included only in the Windows 8.1 SDK (and future SDKs to come I suppose), in the C:\Program Files (x86)\Windows Kits\8.1\Include\um path. The doc doesn't mention that (so you don't need Visual Studio 2013 to be able to use it)

查看更多
登录 后发表回答