28

Hell'o I've just installed Visual Studio 2017 (enterprise).I opened my project whom I created in Visual Studio 2015. My project uses windows.h library but VS2017 cannot find this library. How to repair this?

3
  • 2
    It's very modular installer, check the installation individual packages tab and check if you have the SDK kit(s). If you have check you have the correct SDK kit in project options. Apr 14, 2017 at 11:34
  • 1
    I need fast, step by step, solution. Apr 14, 2017 at 11:36
  • 2
    i've donwload and installed SDK kit - still does not work. Apr 14, 2017 at 11:56

11 Answers 11

70

My solution was :

  • Open the project properties
  • Into General --> SDK Version
  • I just picked the 10.0.15063.0 version instead of 8.1

And it worked.

1
  • 1
    After doing James' modification of the installation, this was the set of steps that fixed it for me. Oct 16, 2017 at 13:28
31

I solved this issue by re-running the Visual Studio Installer and selecting the "Modify" button. Once presented with the Workloads screen I clicked on the "Individual Components" tab and selected all of the latest "Windows 10 SDK" Checkboxes(version 10.0.15063.0). My guess is that the entry for "Desktop C++ x86 and x64" is the one the actually fixes it but it is only speculation because none of those options were checked when I ran the installer and as you can see I checked all of them.

enter image description here

2
  • 1
    I had this error. To modify the installation worked for me. I had the first two pre-selected, but chose just the first and last (the C++ ones), and after that everything worked fine.
    – Darakir
    May 15, 2017 at 9:32
  • I would like to say that I also downloaded this and I was able to solve it too. stackoverflow.com/questions/42777424/… Jun 18, 2017 at 12:25
17

This happens when you have customized include/library paths in legacy projects. If you added your own additional paths in project properties, VisualStudio 2017 can't automatically figure out base paths when switching between platforms/toolsets - normally it automatically puts correct paths there, but if you added customizations, VS won't touch them.

This is legitimate problem which I ran into myself recently when migrating old project targeted for Windows XP into VS2017. None of the answers or comments listed/linked here so far are helpful. I have all legacy SDKs in VisualStudio 2017 installer, and none of that fixed VS not finding essential includes such as <windows.h>. In my case the project was using v120 toolset from VS2013, which is superseded by v140_xp in newer VS.

After setting correct platform and toolset understood by VS2017, I did the following to resolve the problem:

  • Open project properties, go to VC++ Directories, for 'Include Directories' and for 'Library Directories', choose <Inherit from parent or project defaults>. This will remove your additional paths.

  • Click 'Apply'. This will reset include path to something like $(VC_IncludePath_x86);$(WindowsSdk_71A_IncludePath_x86) (will vary for SDKs).

  • Re-add your extra paths here, or better yet - under C/C++/General -> Additional Include Directories and Linker/General -> Additional Library Directories.

2
  • That's the exact issue I had. I removed the additional include paths I had, hit apply, and put my stuff back in, then hit apply again Everything worked straight away after having VS re-scan the solution. Thanks.
    – Nkosi Dean
    Oct 28, 2017 at 5:57
  • Happened to me with visual studio 2019. Had to delete Additional Include Directories and re-add them Mar 5, 2020 at 14:35
6

I got it fixed when I simply changed "General => Windows SDK version" to a different version, submitted the changes and then changed it back.

2

The problem occurs when you migrate your C++ project from a more updated visual studio version to a lesser one. To solve the issue simply go to your : Project's properties-->General-->SDK Version [and here unroll to show installed SDK versions so you downgrade to an available version {Since the required one seems unavailable hence the error}]. Once one of the Available SDKs selected, Apply, and go back to your code, and everything gonna get fixed.

1

If the installation was ok it should be here:

C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\um\Windows.h

So be sure it is on the include path of the project properties.

Project properties

Or if you prefer by manual edit in the .vcxproj file at the IncludePath Tag line:

<IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\um;C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\shared;</IncludePath>
1

TL;DR: make sure the checkbox, marked below, is checked.

In the Include Directories Dlgbox, there's an option at the bottom "Inherit from..." that needs to be checked. Somehow it got unchecked after moving a project to a different solution.

So, in my case, resetting to defaults and adding custom paths again wasn't even needed. Screenshot

0

You have to go in Visual Studio 2017 Installer, choose Individual Components, and manually select and install Windows 8.1 SDK.

0

This step work for me. 1. Open visual studio installer 2. at menu "Visual studio comunity 2017" --> click modify 3. at desktop development with c++ --> enable windows10 SDK for desktop and windows 8.1 SDK 4. click modify

0

I've also installed Visual Studio 2017 (community) first with the default composition settings.I opened my project whom I created in Visual Studio 2015. My project uses windows.h library but VS2017 cannot find this library and other problems. At first I install the missing (SDK 10 ... etc.) components. Part of problems is gone, but windows.h still not found. The problem was solved by completely uninstalling VS2017 and then installing with all the options at once.

0

My solution was checking paths.

Include Directories:

C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um;
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\shared;
%(AdditionalIncludeDirectories)

Library Directories:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\lib\x64

and then right click Solution Explorer: Solution 'xxxxx' (1 project) line click "Retarget solution"

Remember to set Debug setting for Symbols fetch - Windows 10 must use Microsoft symbol server!

Not the answer you're looking for? Browse other questions tagged or ask your own question.