2 u010102669 u010102669 于 2013.11.13 13:26 提问

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个回答

u010723459
u010723459   2013.11.29 20:06
已采纳

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

Csdn user default icon
上传中...
上传图片
插入图片