Another option (does not require windows.h ):
#if defined(_UNICODE) || defined(UNICODE) typedef std::wstring ustring_t; typedef wchar_t uchar_t; #define TEXT(x) (L##x) #else typedef std::string ustring_t; typedef char uchar_t; #define TEXT(x) (x) #endif
Using:
ustring_t mystr = TEXT("hello world");
source share