Unable to compile any Windows drivers. error C1083: Cannot open include file: 'ntddk.h': No such file or directory

Hello!

In the past I was using Windows 11 24H2 with WDK/SDK build 22621. It worked flawlessly. I could compile driver projects just fine. The problem arose after I decided to reinstall and upgrade Windows 11 to 25H2. I’ve been struggling with this issue for a few days now, and nothing seems to resolve it universally on my machine. I simply cannot compile any Windows driver, as the build fails to find the WDK headers.

This is the log from a simple KMDF project freshly created from a Visual Studio template:

1>------ Rebuild All started: Project: KMDF Driver2, Configuration: Release x64 ------
1>Device.c
1>C:\Users\Admin\source\repos\KMDF Driver2\KMDF Driver2\driver.h(17,10): error C1083: Cannot open include file: 'ntddk.h': No such file or directory
1>(compiling source file 'Device.c')
1>Driver.c
1>C:\Users\Admin\source\repos\KMDF Driver2\KMDF Driver2\driver.h(17,10): error C1083: Cannot open include file: 'ntddk.h': No such file or directory
1>(compiling source file 'Driver.c')
1>Queue.c
1>C:\Users\Admin\source\repos\KMDF Driver2\KMDF Driver2\driver.h(17,10): error C1083: Cannot open include file: 'ntddk.h': No such file or directory
1>(compiling source file 'Queue.c')
1>Generating Code...
1>Done building project "KMDF Driver2.vcxproj" -- FAILED.

For the record, I’m currently using Visual Studio Community 2022 17.14.19 (latest as of today) and the latest WDK 10.0.26100.6584 and SDK 10.0.26100.6901. On my other machine the compilation still works (it has the same Visual Studio version, and a bit older SDK/WDK versions, but those have been installed a year ago or so, just like my previous Windows setup), and I don’t recall doing any additional steps beyond installing VS, the SDK, and the WDK. I also tried wiping everything related to Visual Studio, then reinstalling VS with C++ development, Spectre mitigation packages, the WDK extension, and the WDK/SDK from scratch, but to no avail. This must be something specific to new versions, I also wanted to try older SDK/WDK builds, but Microsoft seem to have discontinued all old WDK versions.

This header issue closely resembles this topic (whose solution I also tried), but the C:\Program Files\Windows Kits directory appears no matter which options I choose in Windows SDK installation.

community.osr [DOT] com/t/cannot-open-include-file-ntddk-h-in-a-new-kmdf-project/59680/19

The only thing that “worked” was an ugly hack - using NuGet to install the SDK/WDK at the project level. After that, the project compiled as usual, but that can’t be a real solution, since it would require adding SDK/WDK to dependencies for every single project I have issues with.

Did anybody manage to successfully resolve this issue reliably? I’m honestly at loss here, this issue is driving me insane.

Thanks

It seems that WDKs break each other. I uninstalled all my WDKs and SDKs and just reinstalled the one I needed (24H2 WDK and relevant SDK). I have an old Windows WDK running on VS2017 on a separate machine to support old build (oh I learned to ignore the VD2017 update request because that broke things too).

Thanks for the heads up about 25H2. Best of luck!!!