Share via

How to "include" <wdf.h> (windows kits)

Nick 0 Reputation points
2025-10-17T16:47:46.5466667+00:00

I started to learn driver development on windows and when i start writing code and there is a problem1

i can include wdf.h but a ntddk.h is included. i checked configuration settingsphoto_2_2025-10-17_19-32-16

after that i checked additional file includes (tip from microsoft if you cant include ntddk.h )photo_3_2025-10-17_19-32-16

after i checked where SDK file location photo_4_2025-10-17_19-32-16

where all normally but this error still exists (i reloaded SDK, adding in additional file includes path to wdf ) so i dont know what to do (sorry for my bad english).

Windows development | Windows Driver Kit (WDK)
0 comments No comments

1 answer

Sort by: Most helpful
  1. Tom Tran (WICLOUD CORPORATION) 4,860 Reputation points Microsoft External Staff Moderator
    2025-10-22T04:06:19.6133333+00:00

    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 …\km is in your include paths, but wdf.h is 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 km folder, 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!

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.