Hello everyone,
I think when UNICODE or _UNICODE is defined, when using _T, it could convert characters to wide character.
And I also think LPCSTR should be defined to pointer to wide character when UNICODE or _UNICODE is defined, and LPCSTR should be defined to pointer to multibyte character when UNICODE and _UNICODE are not defined.
But it seems I am wrong for all points. Could anyone explain to me why I get such warnings in Visual Studio 2003?
Code:
#include <windows.h>
#include <TCHAR.h>
#define UNICODE
#define _UNICODE
int main (int argc, char** argv)
{
WCHAR* p = _T("hello");
LPCSTR p1 = p;
LPCWSTR p2 = p;
}
warning messages,
warning C4133: 'initializing' : incompatible types - from 'char [6]' to 'WCHAR *'
warning C4133: 'initializing' : incompatible types - from 'WCHAR *' to 'LPCSTR'
thanks in advance,
George