Board index » Visual Studio » CObject 'class' type redefinition
|
chicagomce
|
CObject 'class' type redefinition
Visual Studio251
Hi, I couldn't figure out the errors and I've checked the MSDN. The error I've got is error C2011: 'CObject': 'class' type redefinition CObject was defined in Object.h CObject.cpp includes CObject.h And in the view class (MFC) as well hence CMyView.h when I comment out CMyView.h, it compiles okay but I need access to CObject.h because I need to define several CObject Objects... What else can I do? //////////////////////////////////////////////////////// CObject.h #ifndef _OBJECT_H_ #define _OBJECT_H_ class CObject { protected: CPerformer* m_pMA; DWORD m_dwMultiAnimIdx; CMesh* m_pAI; vector<CObject *>*m_pv_pChars; CSoundManager* m_pSM; ////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////// CObject.cpp #include "dxstdafx.h" #include "AllocHierarchy.h" #include "DSUtil.h" #include "Object.h" CObject::CObject() { } CObject::~CObject() { Cleanup(); } void CObject::Cleanup() { } ///////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////CMyView.h #include "dxstdafx.h" #include "dsutil.h" #include "AllocHierarchy.h" #include "Object.h" #include <queue> class CMFCSimV6Build1View : public CView, public CD3DApplication { protected: CMyView(); DECLARE_DYNCREATE(CMyView) public: CMyDoc* GetDocument() const; protected: HINSTANCE m_hInstance; LPD3DXMESH m_pMeshFloor; D3DXMATRIX m_mxFloor; D3DMATERIAL9 m_MatFloor; LPDIRECT3DTEXTURE9 m_pTxFloor; ID3DXFont* m_pFont; CFirstPersonCamera m_Camera; float m_fAspectRatio; CSoundManager m_DSound; CPerformer m_Lorry; // inherit from CObject vector< CLorry*>m_v_pLorry; // have definition in the CObject class where CLorry is derived from CObject //////////////////////////////////////////////////////////////////////////////// Thanks Jack - |
