关于虚函数的问题,求救!
error C2555: 'CShowJPEGDoc::OnOpenDocument' : overriding virtual function differs from 'CDocument::OnOpenDocument' only by return type or calling convention
声明是这样的
protected:
//{{AFX_MSG(CShowJPEGDoc)
afx_msg void OnOpenDocument(LPCTSTR lpszPathName);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
定义如下
void CShowJPEGDoc::OnOpenDocument(LPCTSTR lpszPathName)
{
// TODO: Add your command handler code here
DecodeJPGFileToGeneralBuffer(lpszPathName, &width, &height, &buffer, &nchannels);// 得到图像的数据
DecodeJPGFileToDIB(lpszPathName, &dib);// 得到图像的信息头
flag=TRUE;
}
[解决办法]
楼主从提示错误信息应该看出来什么吧。其实原型是这样的啦。
virtual BOOL OnOpenDocument( LPCTSTR lpszPathName );