question

hfaun-1603 avatar image
0 Votes"
hfaun-1603 asked ·

Path to SDK/Include Files in Visual Studio 2015

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.

vs-general
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Castorix31 avatar image
0 Votes"
Castorix31 answered ·

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);



·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

DylanZhu-MSFT avatar image
0 Votes"
DylanZhu-MSFT answered ·

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.


image.png (9.4 KiB)
·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.