缺少 SDKDDKVer.h,但安装了 WinSDK?(C++ 头文件问题)
因此,在 Web 开发、python 和 c# 度过了永恒之后,由于各种无关的原因,我最近在新 PC 上使用 .NET 4.5(Visual Studio 2012 专业版)回到了 VC++.我对整个语言非常满意,它在语法方面非常漂亮,我喜欢内存管理自由、指针和引用.我用你好世界"的东西和 BAM 重新开始!错误.
So I recently returned to VC++ with .NET 4.5 (Visual Studio 2012 professional) due to various irrelevant reasons on a new PC after spending an eternity with web dev, python and c#. I'm pretty comfortable with the language as a whole, it's f**king beautiful in terms of syntax and I love the memory management freedom, pointers and references. I start up again with a "hello world" thing and BAM! Error.
正如许多其他人遇到此问题一样,当我尝试编译和运行时收到 IntelliSense 错误:
As many other people get with this problem, I'm receiving the IntelliSense error when I try to compile and run:
cannot open source file "SDKDDKVer.h"" 和致命错误:"error C1083: Cannot open include file: 'SDKDDKVer.h': No such file or directory
我还安装了 Visual Studio 2010 (C# Express),也许这搞砸了我的一些东西.我已经确认我的 VC++ 目录 incl 和 lib 都是正确的,并且是 Microsoft 和几乎所有 C++ 开发人员推荐的.我试图安装最新的 WinSDK (8.1) 来获取标头及其所有功能,但我大约 110% 确定它不在那里.我现在正在为 Win7 安装 SDK,希望它可以驻留在那里(不过肯定需要很长时间.)
I also have Visual Studio 2010 (C# Express) installed, perhaps that's screwing up some of my stuff. I've confirmed that my VC++ directories for incl and lib are all correct and that recommended by Microsoft and virtually any C++ developer. I attempted to install the most recent WinSDK (8.1) to get the header and all of it's functionality but I'm about 110% certain it's not in there. I'm installing the SDK for Win7 right now in hopes that it might reside in there (it's sure taking a long time though.)
我的电脑有终端蓝屏的问题,只有在将机器单独放置 15 分钟后才能解决任何问题,所以可能是硬盘驱动器问题?
My PC has the issue of terminally blue-screening only for any issue to be resolved upon leaving the machine alone for 15 minutes, so maybe it's a hard-drive issue?
你们中的任何人都可以帮忙吗?绝对任何抬头,居高临下,明显与否,都会受到极大的赞赏,无论如何,感谢您的阅读.
Can any of you help? Absolutely any heads up, condescending, obvious or not will be appreciated a ton, and thanks for reading anyway.
@MichaelBurr 要求提供构建日志,但我无法在底部完整地发布它,所以我想我会在这里添加它.
@MichaelBurr asked for the build log and I couldn't post it in its entirety at the bottom, so I figured I'd add it here.
Build started 14/03/2014 00:34:11.
1>Project "c:UsersBrandondocumentsvisual studio 2012ProjectsConsoleApplication4ConsoleApplication4ConsoleApplication4.vcxproj" on node 2 (Build target(s)).
1>C:Program Files (x86)MSBuildMicrosoft.Cppv4.0V110Microsoft.CppBuild.targets(344,5): warning MSB8003: Could not find WindowsSDKDir variable from the registry. TargetFrameworkVersion or PlatformToolset may be set to an invalid version number.
1>ClCompile:
C:Program Files (x86)Microsoft Visual Studio 11.0VCinCL.exe /c /ZI /nologo /W3 /WX- /sdl /Od /Oy- /D WIN32 /D _DEBUG /D _CONSOLE /D _UNICODE /D UNICODE /Gm /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Yc"stdafx.h" /Fp"DebugConsoleApplication4.pch" /Fo"Debug\" /Fd"Debugvc110.pdb" /Gd /TP /analyze- /errorReport:prompt stdafx.cpp
stdafx.cpp
1>c:usersrandondocumentsvisual studio 2012projectsconsoleapplication4consoleapplication4 argetver.h(8): fatal error C1083: Cannot open include file: 'SDKDDKVer.h': No such file or directory
1>Done Building Project "c:UsersBrandondocumentsvisual studio 2012ProjectsConsoleApplication4ConsoleApplication4ConsoleApplication4.vcxproj" (Build target(s)) -- FAILED.
构建失败.
已用时间 00:00:00.12
Time Elapsed 00:00:00.12
推荐答案
您发布的空白项目是否有同样的问题?我已经尝试使用 Windows 7 32 位和 64 位以及 XP 32 位构建您的项目.一切都很好,找到 SDKDDKVer.h 没问题.
Do you have the same problem the blank project you posted? I have tried and built your project using Windows 7 32 and 64 bit and XP 32 bit. All builds fine, no problem with finding SDKDDKVer.h.
你的依赖路径设置肯定有问题.
You must have some problem with your dependencies path settings.
您可能已经将 VS 设置从一个 VS 安装转移到另一个,可能是从 32 位到 64 位(反之亦然)机器?如果是这种情况,请记住您的路径可能包含错误的文件夹名称.对于 32 位系统,所有应用程序默认安装到 C:Program Files,而在 64 位机器上,所有 32 位应用程序都安装到 Program Files (x86).这是 VS 的情况.所有包含文件都在:
It is possible that you have transferred VS settings from one installation of VS to another, possibly from 32-bit to 64-bit (or vice versa) machine? If this is a case, remember that your path may include wrong folders names. For 32-bit system all applications are installed as default to C:Program Files, while on 64-bit machine all 32bit apps are installed to Program Files (x86). This is a case for VS. All include files are in:
- C:Program Files (x86)Microsoft SDKsWindowsv7.0AInclude -原始VS安装
- C:Program Files (x86)MicrosoftSDKsWindowsv7.1AInclude - 安装 7.1 VS SDK 后
如果您安装了其他 SDK 包,您可能还有另一个包含 SDKDDKVer.h 的文件夹:
If you have other SDK packages installed you may have another folders with SDKDDKVer.h:
- C:Program Files (x86)Windows Kits8.0Includeshared
- C:Program Files (x86)Windows Kits8.1Includeshared
- C:Program FilesMicrosoft SDKsWindowsv6.0AInclude
- C:Program FilesMicrosoft SDKsWindowsv7.0Include
- C:Program FilesMicrosoft SDKsWindowsv7.1Include
在您的项目设置中,您应该具有以下包含路径:
In your project setting you should have the following paths for includes:
- $(VCInstallDir)include
- $(VCInstallDir)atlmfcinclude
- $(WindowsSDK_IncludePath)
注意使用的宏.它们应该从父级的默认设置继承.您可能通过编辑保存在 Microsoft.Cpp.Win32.user.props 文件中的设置覆盖了属性管理器中的路径设置.
Note macros used. They should be inherited from parent’s default setrtings. You may have overridden path settings in Property manager, by editing setting saved in Microsoft.Cpp.Win32.user.props file.
如果您的项目是从 VS 的早期版本转换而来的,则可能会发生这种情况.
It may have happened if your project is converted from earlier versions of VS.
相关文章