Hi @Nick ,
Thanks for sharing the details and screenshots. This is a common setup issue when starting with the Windows Driver Kit (WDK).
The reasons why this happens:
- The project targets an SDK version without kernel headers (
Include\<version>\km) - The WDK Visual Studio integration isn’t fully installed
- Only
…\kmis in your include paths, butwdf.his in…\km\wdf
Here are a few steps to make ntddk.h and wdf.h work:
1. Repair or install WDK integration
- In Visual Studio Installer, check Windows Driver Kit under Individual Components
- If still broken, run the WDK extension manually:
C:\Program Files (x86)\Windows Kits\10\Vsix\VS2022\10.0.26100.0\amd64\WDK.vsix
Reference: Download the WDK
2. Use the correct project and file type
- Create Kernel Mode Driver, Empty (KMDF)
- Add
Driver.c(must be.c, not.cpp)
Reference: Writing a very small KMDF driver
3. Pick an SDK version that has km
- Go to
Project → Properties → General → Windows SDK Version - Choose a version that exists under:
C:\Program Files (x86)\Windows Kits\10\Include\<version>\km - If no
kmfolder, retarget to another installed SDK
Reference: Stack Overflow – Cannot open include file: ntddk.h
4. Add both include paths (if needed)
- In
Project → Properties → C/C++ → Additional Include Directories, add:
C:\Program Files (x86)\Windows Kits\10\Include\<version>\km
C:\Program Files (x86)\Windows Kits\10\Include\<version>\km\wdf
- Or include WDF like this:
#include <wdf/wdf.h>
Reference: GitHub – Cannot open wdf.h issue
5. Build for x64 (don’t define _AMD64_ manually)
- Use
Build → Configuration Manager → Active solution platform = x64 - Do not add
_AMD64_yourself (causes “No Target Architecture” errors)
Reference: Known issues with WDK
Hope this helps! If you find this answer helpful, please consider marking it by following this instruction!