Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual C++ can't find "Windows types" like PVOID, DWORD, ULONG, etc

Windows can't seem to find any of these types, and I'm completely at a loss for what to do. The things I've found on MSDN seem to suggest that they're included by default, but they haven't worked in Native programs or CLR programs.

The specific errors I'm getting are:

"<Project Name>.cpp(10): error C2065: 'PVOID' : undeclared identifier

"<Project Name>.cpp(10): error C2146: syntax error : missing ';' before identifier 'varname'

"<Project Name>.cpp(10): error C2065: 'varname' : undeclared identifier

How can I make Visual C++ recognize these types?

like image 945
dcpomero Avatar asked Aug 04 '11 15:08

dcpomero


People also ask

Where is dword defined?

A dword, which is short for "double word," is a data type definition that is specific to Microsoft Windows. When defined in the file windows. h, a dword is an unsigned, 32-bit unit of data. It can contain an integer value in the range 0 through 4,294,967,295.

Where is dword defined C++?

DWORD is not a C++ type, it's defined in <windows. h> . The reason is that DWORD has a specific range and format Windows functions rely on, so if you require that specific range use that type.


1 Answers

You will need to include windows.h. Add this line at the top of your source file:

#include <windows.h> 
like image 107
James Johnston Avatar answered Oct 10 '22 08:10

James Johnston