sqt兔斯基 2013-11-13 05:26 采纳率: 100%
浏览 1966
已采纳

vc读取位图编译出错。具体问题和代码如下

Compiling...
demo1Doc.cpp
E:\C++练习\数字图像模式识别\demo\demo1\demo1Doc.cpp(33) : error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'class ImageDib *' (or there is no acceptable conversion)
E:\C++练习\数字图像模式识别\demo\demo1\demo1Doc.cpp(39) : error C2678: binary '!=' : no operator defined which takes a left-hand operand of type 'class ImageDib' (or there is no acceptable conversion)
E:\C++练习\数字图像模式识别\demo\demo1\demo1Doc.cpp(41) : error C2440: 'delete' : cannot convert from 'class ImageDib' to ''
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
E:\C++练习\数字图像模式识别\demo\demo1\demo1Doc.cpp(41) : fatal error C1903: unable to recover from previous error(s); stopping compilation
Error executing cl.exe.

demo1.exe - 4 error(s), 0 warning(s)

!定位到代码中,貌似是这一部分出了问题:
CDemo1Doc::CDemo1Doc()
{
// TODO: add one-time construction code here
m_dib = new ImageDib;

}

CDemo1Doc::~CDemo1Doc()
{
if (m_dib != NULL)
{
delete m_dib;
m_dib = 0;
}
}

  • 写回答

1条回答

  • Caesar Tang 2013-11-29 12:06
    关注

    m_dib = new ImageDib;
    左右类型不匹配,目测你是想new一个图片对象,但是类库里似乎没有

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 fesafe材料库问题
  • ¥35 beats蓝牙耳机怎么查看日志
  • ¥15 Fluent齿轮搅油
  • ¥15 八爪鱼爬数据为什么自己停了
  • ¥15 交替优化波束形成和ris反射角使保密速率最大化
  • ¥15 树莓派与pix飞控通信
  • ¥15 自动转发微信群信息到另外一个微信群
  • ¥15 outlook无法配置成功
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统