error C2065: 'Clear' : undeclared identifierBOOL CDipView::ReadFile(CFile *pFile)
{
int nCount, nSize;
BITMAPFILEHEADER bmfh;
Clear();
try {
nCount = pFile->Read((LPVOID) &bmfh, sizeof(BITMAPFILEHEADER));
if(nCount != sizeof(BITMAPFILEHEADER)) {
throw new CException;
}
if(bmfh.bfType != 0x4d42) {
throw new CException;
}
nSize = bmfh.bfOffBits - sizeof(BITMAPFILEHEADER);
m_DibHead = (LPBITMAPINFOHEADER) new char[nSize];
m_nBmpallocate = m_nImageallocate = crtallocate;
nCount = pFile->Read(m_DibHead, nSize);
SetPaletteSize(m_DibHead->biBitCount);
GetPalette();
m_Image = (LPBYTE) new char[m_ImageSize];
nCount = pFile->Read(m_Image, m_ImageSize);
}
catch(CException* tmpc) {
AfxMessageBox("文件读取错误");
tmpc->Delete();
return FALSE;
}
return TRUE;}明明在.cpp和.h中都定义了,怎么提示还是上面的啊
{
int nCount, nSize;
BITMAPFILEHEADER bmfh;
Clear();
try {
nCount = pFile->Read((LPVOID) &bmfh, sizeof(BITMAPFILEHEADER));
if(nCount != sizeof(BITMAPFILEHEADER)) {
throw new CException;
}
if(bmfh.bfType != 0x4d42) {
throw new CException;
}
nSize = bmfh.bfOffBits - sizeof(BITMAPFILEHEADER);
m_DibHead = (LPBITMAPINFOHEADER) new char[nSize];
m_nBmpallocate = m_nImageallocate = crtallocate;
nCount = pFile->Read(m_DibHead, nSize);
SetPaletteSize(m_DibHead->biBitCount);
GetPalette();
m_Image = (LPBYTE) new char[m_ImageSize];
nCount = pFile->Read(m_Image, m_ImageSize);
}
catch(CException* tmpc) {
AfxMessageBox("文件读取错误");
tmpc->Delete();
return FALSE;
}
return TRUE;}明明在.cpp和.h中都定义了,怎么提示还是上面的啊
//
/////////////////////////////////////////////////////////////////////////////#if !defined(AFX_DIPVIEW_H__7CACDD63_524F_444D_9B99_0F59C7EA0319__INCLUDED_)
#define AFX_DIPVIEW_H__7CACDD63_524F_444D_9B99_0F59C7EA0319__INCLUDED_#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class CDipView : public CScrollView
{
protected: // create from serialization only
CDipView();
DECLARE_DYNCREATE(CDipView)// Attributes
public:
CDipDoc* GetDocument();// Operations
public:
int m_x;
HBITMAP m_Bmp;
LPVOID m_ColorList;
LPBYTE m_Image;
LPBITMAPINFOHEADER m_DibHead;
enum allocate {None, crtallocate, heapallocate};
allocate m_nBmpallocate;
allocate m_nImageallocate;
DWORD m_ImageSize;
int m_nPalette;
HANDLE m_hFile;
HANDLE m_hMap;
LPVOID m_lpvFile;
HPALETTE m_hPalette;
HGLOBAL m_hGlob; public:// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDipView)
public:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
virtual void OnInitialUpdate(); // called first time after construct
//}}AFX_VIRTUAL// Implementation
public:
CSize GetDibSize();
BOOL MemToDib(LPVOID lmem);
BOOL DibToDC(CDC* pDC,CSize size);
BOOL GetPalette();
BOOL SetPalette();
BOOL ReadFile(CFile *pFile);
void clear();
void SetPaletteSize(int nBitCount);
void zftjh(unsigned char *lpDib,long lWidth,long lHeight);
virtual ~CDipView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endifprotected:// Generated message map functions
protected:
//{{AFX_MSG(CDipView)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};#ifndef _DEBUG // debug version in dipView.cpp
inline CDipDoc* CDipView::GetDocument()
{ return (CDipDoc*)m_pDocument; }
#endif///////////////////////////////////////////////////////////////////////////////{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.#endif // !defined(AFX_DIPVIEW_H__7CACDD63_524F_444D_9B99_0F59C7EA0319__INCLUDED_)
这是在.h中添加的
void clear();
在调用函数写的是Clear();囧,注意大小写