Take the 2-minute tour ×

I have a C++ program that uses LPDWORD, DWORD, etc. When I compile using GCC, it throws an error. How do I handle LPDWORD, DWORD, LPBYTE, and LPTSTR in GCC?

share|improve this question

4 Answers 4

typedef uint32_t* LPDWORD;
typedef uint32_t DWORD;
// etc
share|improve this answer
thanks for your response, for LPSTR, LPBYTE ? –  JKS Jun 4 '10 at 13:15
typedef char* LPSTR; typedef unsigned char* LPBYTE; –  Kirill V. Lyadvinsky Jun 4 '10 at 13:34
very very thank you –  JKS Jun 4 '10 at 15:12

Those are types defined in the Windows specific header file windows.h. If your code uses those types, it probably uses a lot of Windows specific functions too, and thus will not be portable. That's not to say you can't compile such code with GCC - you can with the MinGW port, but this will only work on Windows.

share|improve this answer
Actually these types are defined in windev.h. Including windows.h gives you the types but you get a lot of additional declarations you won't need. –  harper Jun 4 '10 at 13:53
@harper If you don't call the functions, I don't see why you need the types. –  anon Jun 4 '10 at 13:59
Sure, you have to include all header files for appropriate prototypes. But feel free to use the type BYTE for something that is just a byte independent of the operating system or any specific function. But Suriyan Suresh asked just for support for these types. No missing function prototypes were noticed. So it's less work to look at that file, that holds the definitions. –  harper Jun 4 '10 at 16:29

All of those typedefs are Microsoft's version of the GCC's typedefs. If you only have some of them in your program, you can add a header file to convert them into GCC's semantics.

See this MSDN page for more info on Microsoft's data types:


share|improve this answer

If you're on a Windows system, you can use

#include <windows.h>

These datatypes are typical Windows API datatypes.

If you're on another platform, you can typedef the datatypes, but it's likely that the problems will go on and you'll have to port much of the code.

share|improve this answer

Your Answer


