C++ 错误C2678:&x27==';二进制:未找到接受类型为';的左操作数的运算符;CSchemaString';(或没有可接受的转换)

C++ 错误C2678:&x27==';二进制:未找到接受类型为';的左操作数的运算符;CSchemaString';(或没有可接受的转换),c++,.net,c++-cli,C++,.net,C++ Cli,我正在将一个项目从VC++6转移到VC++2005,编译时出现以下错误 错误C2678:“==”二进制:未找到接受左操作数的运算符 类型为“CSchemaString”(或没有可接受的转换) 这是代码 CSchemaString References("id"); for(j=0;j<=tpChild.GetUpperBound();j++) { if(References == "id") //error C2678: '==' binary: no operator found

我正在将一个项目从
VC++6
转移到
VC++2005
,编译时出现以下错误

错误C2678:“==”二进制:未找到接受左操作数的运算符 类型为“CSchemaString”(或没有可接受的转换)

这是代码

CSchemaString References("id");
for(j=0;j<=tpChild.GetUpperBound();j++)
{
    if(References == "id") //error C2678: '==' binary: no operator found which takes a left operand of type 'CSchemaString' (or there is no acceptable conversion)

        References = References + intToString(((Component*)tpChild.GetAt(j))->GetComponentID()) +"_"+ ((Component*)tpChild.GetAt(j))->GetName();
    else
        References = References + " id" + intToString(((Component*)tpChild.GetAt(j))->GetComponentID()) +"_"+((Component*)tpChild.GetAt(j))->GetName();
}
if(References != "id") //si references n'est pas vide
    XComponent.AddPlant_Item_Ref(References);



return XComponent;
cschema字符串引用(“id”);
对于(j=0;jGetComponentID())+“”+((组件*)tpChild.GetAt(j))->GetName();
其他的
References=References+“id”+intToString(((组件*)tpChild.GetAt(j))->GetComponentID())+“+((组件*)tpChild.GetAt(j))->GetName();
}
if(References!=“id”)//si引用不可提供
X组件。添加设备项目参考(参考);
返回XComponent;
}


感谢您的帮助。

字符串不是字符串。你需要这样做

References.ToString() == "id"

字符串不是字符串。你需要这样做

References.ToString() == "id"