Including WDK issue on Visual Studio

drjackool 956 Reputation points
2022-07-20T18:58:41.463+00:00

Hi

I have an MFC project and I want to use ntddkbd.h header file, but when including it get following errors: How solve it?!
I added this path to VC include dir: "C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared"

Visual Studio is 2022 ver 17.0 and installed WDK is for Win 11 (All of them are installed on a Virtual Machine on Windows 7)

Errored source line is _VARIANT_BOOL bool;

error C2144: syntax error: 'bool' should be preceded by ';'
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include\oaidl.h(445): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include\oaidl.h(445): error C2208: 'bool': no members defined using this type
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include\oaidl.h(460): error C2143: syntax error: missing ';' before '*'
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include\oaidl.h(460): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include\oaidl.h(460): error C2238: unexpected token(s) preceding ';'
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include\propidl.h(319): error C2144: syntax error: 'bool' should be preceded by ';'
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include\propidl.h(319): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include\propidl.h(319): error C2208: 'bool': no members defined using this type

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,640 questions
Visual Studio Setup
Visual Studio Setup
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Setup: The procedures involved in preparing a software program or application to operate within a computer or mobile device.
971 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Viorel 112.5K Reputation points
    2022-07-21T03:14:07.767+00:00

    For example, include Windows.h before ntddkbd.h.

    0 comments No comments