0

I am using mingw32, where I cant find type definition of LPCTSTR to LPCWSTR. But the same is defined in mingw64 as below.

typedef LPCWSTR PCTSTR,LPCTSTR;

But my code works fine in mingw32 without any error even I added LPCTSTR in my code, and if I change the compiler options to mingw64 I am getting lots of errors.

Winnt.h in mingw32:

typedef TCHAR TBYTE,*PTCH,*PTBYTE;
typedef TCHAR *LPTCH,*PTSTR,*LPTSTR,*LP,*PTCHAR;
typedef const TCHAR *LPCTSTR;

winnt.h in mingw64:

typedef LPWSTR LPTCH,PTCH;
typedef LPWSTR PTSTR,LPTSTR;
typedef LPCWSTR PCTSTR,LPCTSTR;
typedef LPUWSTR PUTSTR,LPUTSTR;
typedef LPCUWSTR PCUTSTR,LPCUTSTR;
typedef LPWSTR LP;

How to solve this? why I am not getting any error in mingw32, with UNICODE defined?

2vision2
  • 4,933
  • 16
  • 83
  • 164
  • Why do you expect errors in mingw32? The definition of `LPCTSTR` is right there in the code you posted. And we can't help you with the errors you got with mingw64 unless we see your code and the actual errors... – interjay Aug 16 '12 at 17:29
  • @interjay my doubt here is, I can see LPCTSTR typedef'ed as LPCWSTR when UNICODE is defined in Mingw64 and the same typedef is not there in Mingw32. – 2vision2 Aug 17 '12 at 03:47

1 Answers1

2

LPCTSTR is being defined in mingw32 as:

typedef const TCHAR *LPCTSTR;

When UNICODE is defined, TCHAR maps to WCHAR, making LPCTSTR equivilent to LPCWSTR.

When UNICODE is not defined, TCHAR maps to CHAR instead, making LPCTSTR equivilent to LPCSTR.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770