【发布时间】:2019-03-10 06:13:54
【问题描述】:
struct StaticString
{
StaticString() { Str = NULL; }
~StaticString() { if(Str) delete [] Str; Str=0; }
char* Str;
void operator = (const char * pchar)
{
Str = new char[strlen(pchar)+1];
strcpy(Str,pchar);
}
operator LPCTSTR() const
{
return Str;
}
operator PCHAR() const
{
return Str;
}
};
错误 C2440:'return':无法从 'char *const' 转换为 'LPCTSTR'
它来自游戏。我该如何解决?我在谷歌搜索,但没有人工作
【问题讨论】:
-
char to LPCTSTR的可能重复
-
你定义了 UNICODE 吗?如果您永远避免使用 TCHAR,您将是在帮自己一个忙。
-
我定义了我的 UNICODE
标签: visual-c++