c++ - 错误 C2678 : '==' binary: no operator found which takes a left operand of type 'CSchemaString' (or there is no acceptable conversion)

标签 c++ .net c++-cli

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

error C2678: '==' binary: no operator found which takes a left operand of type 'CSchemaString' (or there is no acceptable conversion)

这是代码;

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;

感谢任何帮助。

最佳答案

CSchemaString 不是字符串。你需要做的

References.ToString() == "id"

关于c++ - 错误 C2678 : '==' binary: no operator found which takes a left operand of type 'CSchemaString' (or there is no acceptable conversion),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11581828/

相关文章:

.net - 在线程上调用方法,使用异步编程模型的工作任务以及使用BackgroundWorkerThread的工作之间有什么基本区别?

c# - 在 .NET 中使用 secret 加密/混淆字节数组的简单方法?

delegates - c++/cli 终结器中免费 GCHandle 的最佳实践

visual-c++ - 错误 C3699 : '^' : cannot use this indirection on type 'std::string'

c++ - 为什么C++中有这么多字符串类型?

c++ - For_each 和指向成员函数的指针

c++ - 通过函数传递自定义比较器

c++ - 显示自定义图像并能够捕获鼠标输入

c++ - 什么时候应该在函数返回值上使用 std::move?

c# - 无法通过 TCP/Sockets .net 退出具有多个缓冲区传输的循环