Fresh installation of VS 2012 will not build default console application: Missing SDKDDKVer.h (and stdio.h / CRT)

12,096

Solution 1

After I set up Visual Studio 2013, I had same sdk error for a simple C++ code. I solve same problem with below steps:

  • Select Project Properties>Configuration>VC++ Directories>Include Directories and add that: c:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include
  • Select Project Properties>Configuration>VC++ Directories>Library Directories and add that: c:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib

After that configuration I had problem about rc.exe link error. For this problem one more thing is needed:

  • copy RC.exe and RcDll.dll files from C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Bin and past them to C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin

After all those configuration steps, you can build a simple "Hello World!" example and run if you are lucky.

Solution 2

from MSDN forum:

Looking at the Include Directories for this project, I see the following

$(WindowsSdkDir)include

"WindowsSdkDir" is defined to be "C:\Program Files (x86)\Windows Kits\8.0\"

Unfortunately, the folder "C:\Program Files (x86)\Windows Kits\8.0\Include\" doesn't actually have any header files in it. Instead it contains three sub-folders. One of these is the folder called "shared" which happens to contain the "SDKDDKVer.h" file shown in the error message.

If this is your situation, replace $(WindowsSdkDir)include by the three folder names (at least $(WindowsSdkDir)include\shared) in your include path in your project properties under VC++ Directories.

To add this path permanently to VS2012, you'll need to make changes to the Microsoft.Cpp.Win32.user.props file under the C:\Users\xxx\AppData\Local\Microsoft\MSBuild\v4.0 folder (where xxx is your user name).

Solution 3

I had this problem with VS2013. Turns out when I separately installed Windows SDK 8.1 first, then Visual Studio 2013, it fixed the problem.

I should also note that I was installing this on a Windows 7 w SP 1 VM and at no point during the installation did it have a connection to the internet (I have read elsewhere some folks think an internet connection during install will fix the problem, but I was personally unable to verify that, and now that I have it working I'm not going to backtrack and test it).

Share:
12,096
Dan Nissenbaum
Author by

Dan Nissenbaum

Freelance C++ and PHP developer, with PhD in physics, in Brattleboro, VT, USA Generally with bare feet Best to all!

Updated on June 15, 2022

Comments

  • Dan Nissenbaum
    Dan Nissenbaum almost 2 years

    I have been using the trial version of VS 2012 Professional for about 1 month on my Windows 7 64-bit machine.

    Today, I noticed that the Platform Toolset option (project properties) was set for Visual Studio 2010 (v100), which seemed odd, because I am running VS 2012. Changing the "Platform Toolset" to VS 2012 resulted in the error noted in the title of this question:

    Cannot open include file: 'SDKDDKVer.h': No such file or directory

    ... while building stdafx.cpp (the error itself occurs in the file targetver.h).

    A forum discussion I was browsing earlier hinted that the presence of VS 2010 during a VS 2012 install might have caused the problem. (I do not have links to those posts currently on hand.)

    Because I have recently purchased VS 2012 Professional, I uninstalled the trial version of VS 2012, and then reinstalled a paid version VS 2012 (Professional) from a fresh download from the MSDN website. All told, the uninstall/reinstall required 2 hours or so.

    During the reinstallation of VS 2012, I paid very close attention to all possible options, to see if any option might conceivably have caused the VS 2012 installer to "skip" the VS 2012 header files or other VS 2012 components, and use VS 2010 components instead. I could find no such option.

    Reinstallation of VS 2012 was successful.

    I created a new console project in a new workspace (note that my "recent projects list" still showed my recent VS 2012 projects, despite the uninstall/reinstall). The project settings for the new console project showed that the correct toolset was being used - Platform Toolset = Visual Studio 2012 (v110).

    Unfortunately, building the out-of-the-box VS 2012 console application (including the precompiled header option, but no other option in the Create Project Wizard), results in exactly the same error:

    Cannot open include file: 'SDKDDKVer.h': No such file or directory

    What should I do?

    .

    ADDENDUM: Note for future readers; after changing path settings (see comments beneath answer, below) so that VS 2012 finds SDKDDKVer.h, it nonetheless fails to find stdio.h, a more serious problem because the VC11 version of stdio.h (as well as all the VC11 CRT headers) is not available on the machine anywhere.

    Unfortunately, Microsoft has still not resolved these major bugs in their VS 2012 installation process. The only way I found to get a working VS 2012 installation including all VC11 CRT files is to:

    • Wipe your system completely clean of all MS products (this may be overkill, but I had to at least uninstall VS 2010 in addition to uninstalling VS 2012)
    • Remove the registry keys noted in the comments to the answer below (to be safe)
    • Delete residual directories (to be safe)
    • Restart (to be safe)
    • Install VS 2012 from scratch FROM THE .ISO, not the installer (assuming the installation files are downloaded from the MSDN site) (use a program like Power2Go to mount the .iso)
    • THEN, be absolutely sure to install VS 2012 Service Pack 1 (through "Windows Update" control panel) (without doing this step, the VC11 CRT headers are STILL not installed anywhere on the machine)
    • And finally, map the Windows SDK library directories as described in [this link](Link now points to a scam site, removed) (without doing this latter step, the linker fails to finde the path to the Windows kernel library)

    ... THEN there is a working installation of VS 2012.

    Thanks alot, Microsoft.

  • Dan Nissenbaum
    Dan Nissenbaum about 11 years
    This suggestion is from the forum posting that I referenced in my question, but that I did not provide a link for, thanks. I have already attempted to replace the $(WindowsSdkDir)include entry in the include path with those that point to the proper location. In fact, the problem is deeper, and I did not append my question to note the deeper problem. The compiler is able to properly locate the SDKDDKVer.h file after the change. However, all of the VC11 CRT header files are missing - they simply don't exist anywhere on the computer. VS 2012 has install problems. I must post another question.
  • Edward Clements
    Edward Clements about 11 years
    just to check: so either the C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include folder does not exist, or is empty?
  • Dan Nissenbaum
    Dan Nissenbaum about 11 years
    Correct. The folder contains a small number of files (I forget which, because I have uninstalled all Visual Studio editions; see following comment), but it did not contain any header files in that folder, or any subfolders. Completely empty of headers. Many postings discuss this issue (for example, social.msdn.microsoft.com/Forums/en-US/vssetup/thread/…, and many others). After having uninstalled all previous VS editions (and relevant registry keys) and restarted, I am now installing VS 2012 from the .iso download, not the installer. I will report.
  • Dan Nissenbaum
    Dan Nissenbaum about 11 years
    After uninstalling every trace of every installed Microsoft product (all editions of VS, all editions of SQL Server, Office, all versions of .NET runtime, all VC redistributables, and all other MS entries in Add/Remove Programs); going through the file system (particularly Program Files [(x86)] and hand-deleting all remaining relevant Microsoft directories; removing all relevant VS entries in both 32- and 64- bit Software nodes of HKLM and HKCU in the registry, restarting, installing VS2012 from .iso (not instllr), installing VS 2012 SP1, and following lucatarrini.net/?p=1442, it works.