brightak
asked on
member function already defined or declared
I'm trying to compile a VC++ 6 program I inherited. I'm getting 157 instances of the above error message in my header file that defines my document MFC -- all from the implementation. The offending code snippet is attached. I changed the program name to protect the innocent.
// Implementation
public:
virtual ~CMyProgDoc();
// Overloaded Operators
CMyProgDoc& operator =(CMyProgDoc& Doc);
CMyProgTableView* GetTableView();
CMyProgExplorerView* GetExplorerView();
CMyProgBarView* GetBarView();
CMyProgPieView* GetPieView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump( CDumpContext& dc ) const;
#endif
// Implementation - copied from MyProg v 1
public:
virtual ~CMyProgDoc();
// Overloaded Operators
CMyProgDoc& operator =(CMyProgDoc& Doc);
CMyProgTableView* GetTableView();
CMyProgExplorerView* GetExplorerView();
CMyProgBarView* GetBarView();
CMyProgPieView* GetPieView();
Of course MYHEADERNAME_H should be different for every header file.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I copied the code as is (which is why I didn't think of that). Maybe I got a bad version.
someheader.h
#ifndef MYHEADERNAME_H
#define MYHEADERNAME_H
all your header code here
#endif
repeat the same for all your header files (.h)