那失去的过往 2016-10-31 14:44 采纳率: 100%
浏览 1275
已采纳

求帮忙找程序的error并让他能在vc++中运行。


这个网页中的代码,我复制下来之后粘贴在VC++,出现了这样的错误。怎么修改才能在VC++中运行呢?希望能把修改好之后的代码发出来。

--------------------Configuration: Cpp1 - Win32 Debug--------------------
Compiling...
Cpp1.cpp
c:\users\administrator\desktop\cpp1.cpp(46) : error C2065: 'assert' : undeclared identifier
c:\users\administrator\desktop\cpp1.cpp(599) : error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'class std::basic_string,class std::allocator >' (or there is no acceptab
le conversion)
c:\users\administrator\desktop\cpp1.cpp(601) : error C2679: binary '>>' : no operator defined which takes a right-hand operand of type 'class std::basic_string,class std::allocator >' (or there is no acceptab
le conversion)
c:\users\administrator\desktop\cpp1.cpp(602) : error C2676: binary '==' : 'class std::basic_string,class std::allocator >' does not define this operator or a conversion to a type acceptable to the predefined
operator
c:\users\administrator\desktop\cpp1.cpp(602) : error C2676: binary '==' : 'class std::basic_string,class std::allocator >' does not define this operator or a conversion to a type acceptable to the predefined
operator
执行 cl.exe 时出错.

Cpp1.exe - 1 error(s), 0 warning(s)

  • 写回答

4条回答 默认 最新

  • lx624909677 2016-11-01 01:12
    关注

    你比较了两个自定义类型的变量,用了比较运算符,然后没有重载对应的运算符,两个自定义的类型想要直接用==去比较, 需要自己去重载==运算符

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘