0

我正在使用 mingw32,我在其中找不到 LPCTSTR 到 LPCWSTR 的类型定义。但在 mingw64 中定义如下。

typedef LPCWSTR PCTSTR,LPCTSTR;

但是works fine in mingw32即使我在代码中添加了我的代码也没有任何错误LPCTSTR,如果我将编译器选项更改为 mingw64,我会遇到很多错误。

mingw32 中的 Winnt.h:

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

mingw64 中的 winnt.h:

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

如何解决这个问题?为什么在定义 UNICODE 的 mingw32 中我没有收到任何错误?

4

1 回答 1

2

LPCTSTR在 mingw32 中被定义为:

typedef const TCHAR *LPCTSTR;

UNICODE定义时,TCHAR映射到WCHARLPCTSTR等效于LPCWSTR

UNICODE未定义时,改为TCHAR映射到CHARLPCTSTR等效于LPCSTR.

于 2012-08-16T19:58:34.003 回答