Cannot open include file: 'ntddk.h'

I am trying to enter the driver development (do not do this queue) I watched this msdn page and after installing WDK (Windows Kit driver) 10 I still can’t compile the example that they use on this page.

I looked at other SO issues , but I cannot find the installed WDK directory. When I try to start the setup, the following welcomes me: WDK Setup image

How can i solve this?

+11
c ++ visual-studio-2015 driver wdk
source share
4 answers

You need to add the WDK headers path to your include vcxproj directories:
Vcxproj Properties -> C / C ++ -> General -> Include Additional Directories

C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\km\ 

PS: Make sure you install SDK 10 along with WDK 10.
PPS: Without SDK, you will get Cannot open include file: 'ntdef.h'

+9
source share

Rule of thumb

When you need to create the latest (or specific) version of the WDK, make sure that the appropriate version of the Win SDK is installed.

Supposed reason

In the process of debugging the problem, it turned out that (due to the SDK version) the build process set $ (LastTargetPlatformVersion) to 10.0.10586. Although the installed WDK provides the necessary build file versions only for version 10.0.14393. This seems to be a somewhat conceived behavior.

My case

In my case, this was due to different versions of the Win SDK and WDK . I had SDK 10.0.10586 and WDK 10.0.14393. Installing SDK 10.0.14393 solved the problem for me.

Side note

The Win SDK is installed with the default layout VS2015, but for some reason it does not receive updates during the VS update process.

+2
source share

There is a macro $ (DDK_INC_PATH) that you can add to include the directories of your project (vcxproj properties β†’ VC ++ Directories β†’ Include Directories)

+1
source share

I solved it by selecting another "version of the Windows SDK" in Visual Studio under "Project Properties" β†’ "General".

In the directory C:\Program Files (x86)\Windows Kits\10\Include I have 5 folders with the Windows SDK. In the latest version (10.0.17763.0) there was no km subfolder. After changing the version of the Windows SDK from 10.0.17763.0 to 10.0.17134.0 header was found in Visual Studio.

0
source share

All Articles