求教c++大神,怎么在类里添加一个成员函数?

这要怎么填啊?填了也不让点确定啊。。。还有大神帮忙看一下这段代码怎么改啊??void CTestView::Onwww() { // TODO: Add your command handler code here // 灰度均衡 CTestDoc* pDoc= GetDocument(); LPSTR lpDIB; // 指向DIB的指针 LPSTR lpDIBBits; // 指向DIB象素指针 lpDIB = (LPSTR) ::GlobalLock((HGLOBAL) pDoc->GetHDIB()); // 找到DIB图像象素起始位置 lpDIBBits = pDoc->GetDibImage()->FindDIBBits(lpDIB); // 判断是否是8-bpp位图(这里为了方便,只处理8-bpp位图的直方图均衡,其它的可以类推) if (pDoc->GetDibImage()->DIBNumColors(lpDIB) != 256) { MessageBox("目前只支持256色位图的直方图均衡!", "系统提示" , MB_ICONINFORMATION | MB_OK); ::GlobalUnlock((HGLOBAL) pDoc->GetHDIB()); return; } BeginWaitCursor(); // 调用InteEqualize()函数进行直方图均衡 pDoc->GetDibImage()->InteEqualize(lpDIBBits,pDoc->GetDibImage()->DIBWidth(lpDIB), pDoc->GetDibImage()->DIBHeight(lpDIB)); pDoc->SetModifiedFlag(TRUE); // 设置脏标记 pDoc->UpdateAllViews(NULL); // 更新视图 ::GlobalUnlock((HGLOBAL) pDoc->GetHDIB()); EndWaitCursor();}这是错误:D:尀test尀testView.cpp(171) : error C2039: ✀GetDibImage✀ : is not a member of ✀CTestDoc✀ d:尀test尀testdoc.h(14) : see declaration of ✀CTestDoc✀D:尀test尀testView.cpp(171) : error C2227: left of ✀->FindDIBBits✀ must point to class/struct/unionD:尀test尀testView.cpp(174) : error C2039: ✀GetDibImage✀ : is not a member of ✀CTestDoc✀ d:尀test尀testdoc.h(14) : see declaration of ✀CTestDoc✀D:尀test尀testView.cpp(174) : error C2227: left of ✀->DIBNumColors✀ must point to class/struct/unionD:尀test尀testView.cpp(186) : error C2039: ✀GetDibImage✀ : is not a member of ✀CTestDoc✀ d:尀test尀testdoc.h(14) : see declaration of ✀CTestDoc✀都是类似这样的错误,要怎么改,真心求教,挺着急的
2026年09月27日 23:21
有1个网友回答
网友(1):

不用这玩意儿,直接在头文件里手动添加
error C2039: 'GetDibImage' : is not a member of 'CTestDoc'
提示GetDibImage不是CTestDoc的类成员函数
GetDibImage添加到这个类中