C++ 调试在Visual Studio中找不到'='运算符
C++ Debugging no '=' operator found in Visual Studio
Visual Studio在我尝试编译C++项目时给我这个错误:
Severity: Error
Code: C2678
Description: binary '=': no operator found which takes a left-hand operand of type 'const std::string' (or there is no acceptable conversion)
Project: jr
File: c:program files (x86)microsoft visual studio 14.0vcincludeutility
Line: 192
我想,在我的项目中的某个地方,我正在尝试更改常量字符串。如何找到它?如何调试此类错误?
错误中提到的文件名和行是一些只读文件Microsoft。我想在我的代码中找到错误。以下是第 192 行周围的代码摘录:
_Myt& operator=(const _Myt& _Right)
{ // assign from copied pair
first = _Right.first;
second = _Right.second;
return (*this);
}
您可能希望编写如下代码:
const std::string s;
s = "";
这就是为什么错误说const
类型:"const std::string"
另一种可能性是您希望在 const 方法中为字符串赋值。
相关文章:
- 为什么 std::variant 找不到运算符<() 当与比较类不在同一命名空间中时
- 为什么 c++ 编译器找不到运算符<<
- 错误 C2679:二进制'<<':找不到采用类型 'overloaded-function' 的右侧操作数的运算符(或者没有可接受的转换)
- 为什么C++找不到布尔运算符,当有一个!范围内的运算符?
- g++ std::set 找不到运算符<为类定义
- 为什么找不到使用命名空间中定义的类型实例化的 std::weak_ptr 的重载运算符==?
- <<找不到运算符,尽管定义了 Foo 类型的右操作数,但该运算符仍采用类型为 Foo 的右侧操作数
- 类没有合适的复制构造函数,找不到二进制运算符 '=',
- 找不到数字文字运算符“运算符”“+BLA”
- 错误:找不到数字文字运算符"运算符 " " U"?
- 模板 = 找不到运算符
- 错误 C2679:二进制'>':找不到采用类型 'int' 的右侧操作数的运算符(或者没有可接受的转换)
- Arduino IDE告诉我找不到字符串文字运算符“运算符”“DRIVE”
- C++ STL 比较映射找不到(运算符==)
- 错误 C2679:二进制"[":找不到采用右侧操作数的运算符
- 为什么我们在使用宏时找不到合适的运算符重载
- C++ 调试在Visual Studio中找不到'='运算符
- 在自定义双链接列表中的自定义迭代器的取消运算符,找不到二进制操作员
- 错误的任何修复:二进制">>"找不到运算符
- 为什么找不到重载运算符函数?