Reputation: 479
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?
Upvotes: 30
Views: 102973
Reputation: 462
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.
Upvotes: 1
Reputation: 7012
I got it fixed when I simply changed "General => Windows SDK version" to a different version, submitted the changes and then changed it back.
Upvotes: 6
Reputation: 1
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!
Upvotes: 0
Reputation: 51
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.
Upvotes: 2
Reputation: 1
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.
Upvotes: 0
Reputation: 11
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
Upvotes: 0
Reputation: 676
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.
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>
Upvotes: 1
Reputation: 835
My solution was :
And it worked.
Upvotes: 70
Reputation: 1328
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.
Upvotes: 18
Reputation: 91
You have to go in Visual Studio 2017 Installer, choose Individual Components, and manually select and install Windows 8.1 SDK.
Upvotes: 0
Reputation: 857
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.
Upvotes: 31