switch为什么不能用CString类型?
以下这段代码为什么会出错,不能用CString类型吗?
错误信息:
: error C2450: switch expression of type 'class CString' is illegal
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
: error C2051: case expression not constant
代码:
CString Schtext;
switch(Shztext)
{
case _T("名称"):
Schtext = "NoteText";
break;
}
请各位帮帮忙,Thank YOU!!!!