那失去的过往 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 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?
  • ¥15 乘性高斯噪声在深度学习网络中的应用
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛