没有找到接受“std::string”类型的左操作数的运算符

来源:互联网 发布:netcat windows 编辑:程序博客网 时间:2024/06/05 17:59

今天遇到一个Bug:  

二进制“==”: 没有找到接受“std::string”类型的左操作数的运算符(或没有可接受的转换)


还有一种情况:

error C2784: “bool std::operator ==(const std::vector<_Ty,_Alloc> &,const std::vector<_Ty,_Alloc> &)”: 无法从“重载函数类型”为“const std::vector<_Ty,_Alloc> &”推导 <未知> 参数


“==”: “const std::string”不定义该运算符或到预定义运算符可接收的类型的转换


解决方法:增加头文件   #include<string>

0 0