Re: Error message in function overloading
On Thu, 29 May 2008 10:15:22 +0900, JY Kim <jkim747.n0zpam@paran.com>
wrote:
Hello.
I am working with source which is not for MFC. It seems to be coded
for their own class library.
When I got this code, source file didn't included "stdAfx.h" and
include some other header file.
So it spawns lots of error message when I compile with MFC.
One message is on function overloading
code is as below.
--
BOOL CEdit::Create(HINSTANCE hInstance, DWORD dwStyle, const RECT&
rect, CWnd* pParentWnd, UINT nID)
{
CWnd* pWnd = this;
return pWnd->Create(_T("EDIT"), NULL, dwStyle, rect,
pParentWnd, hInstance, (HMENU)nID, NULL);
}
--
in .h file
--
class CEdit
: public CWnd
{
DECLARE_RUNTIMECLASS(CEdit)
// Constructors
public:
CEdit();
virtual ~CEdit();
BOOL Create(HINSTANCE hInstance, DWORD dwStyle, const RECT&
rect, CWnd* pParentWnd, UINT nID);
...
...
--
error message is
--
error C2511: 'Create' : overloaded member function 'int (struct
HINSTANCE__ *,unsigned long,const struct tagRECT &,class CWnd
*,unsigned int)' not found in 'CEdit'
c:\program files\microsoft visual
studio\vc98\mfc\include\afxwin.h(2974) : see declaration of 'CEdit'
MFC has always had its own class named "CEdit". You're going to have to
rename your class or put it in a namespace. Renaming is the better choice
by far, because it would be confusing to have two classes named CEdit in an
MFC program. It just wouldn't occur to an MFC user that "CEdit" means
anything but MFC's CEdit.
--
Doug Harrison
Visual C++ MVP