程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 編程綜合問答 >> visual c++-vc讀取位圖編譯出錯。具體問題和代碼如下

visual c++-vc讀取位圖編譯出錯。具體問題和代碼如下

編輯:編程綜合問答
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;
}
}

最佳回答:


m_dib = new ImageDib;
左右類型不匹配,目測你是想new一個圖片對象,但是類庫裡似乎沒有

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved