Path to SDK/Include Files in Visual Studio 2015

hfaun 1 Reputation point
2021-03-13T02:40:17.767+00:00

I have some code that I could compile just fine on a system with VS2013 (and VS2015). However, the same code does not compile on a system with just VS2015. One of the errors is that it can't find windows.h.

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

It seems that in VS2015 "VC++ Directories" (in the project properties) points to invalid directories. I am saying this because on both systems, i.e. the one with VS2013 and the one with VS2015 I see windows.h in the same 4 directories as listed below. I would have expected additional/different directories for the system with VS2015. But on the system with VS2015 none of the "VC++ Directories" points to any of those 4 directories where windows.h is located.

C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include
C:\Program Files (x86)\Microsoft Kits\8.1\Include\um
C:\Program Files (x86)\Microsoft Phone Kits\8.1\Include
C:\Program Files (x86)\Microsoft Phone Silverlight Kits\8.1\Include

Some people recommended to just manually add the include directory but that can't be the solution. That's a workaround that eventually will break. Another solution I saw is to add SDK 10 during the installation but I don't see that option in VS2015 Prof. Does that mean I have to manually install SDK 10? That doesn't seem to make any sense. Any help is appreciated.

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,604 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Dylan Zhu-MSFT 6,406 Reputation points
    2021-03-15T08:06:25.987+00:00

    Hi hfaun,

    It seems that your current installed sdk version doesn't match the project configuration. Please go to Project Properties, then switch Target Platform Version to installed version.
    77723-image.png
    Best Regards,
    Dylan


    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our **documentation to enable e-mail notifications if you want to receive the related email notification for this thread.**

    1 person found this answer helpful.
    0 comments No comments

  2. Castorix31 81,721 Reputation points
    2021-03-13T05:59:35.577+00:00

    Does that mean I have to manually install SDK 10? That doesn't seem to make any sense. Any help is appreciated.

    You can try do download/install the Windows 10 SDK
    It should set correctly the macros for paths

    I don't have VS 2015 anymore, but in VS 2019, I have for "Include Directories" :

    $(VC_IncludePath);$(WindowsSDK_IncludePath);

    0 comments No comments