Your problem is that panel.h is including hardball.h. Except hardball.h needs CPanel to be defined (it tries to include panel.h but the preprocessor definition will stop it from including) so therefore by the time the compiler gets to the definition of CPanel *m_pPanel1 CPanel hasn't been defined.
Here is one way to fix it:
use this as hardball.h
#ifndef HARDBALL_H#define HARDBALL_H#include "window.h"#include "direct3d.h"#define SafeRelease(pInterface) if(pInterface != NULL) {pInterface->Release(); pInterface=NULL;}#define SafeDelete(pObject) if(pObject != NULL) {delete pObject; pObject=NULL;}class CHardball{ public: CHardball(); virtual ~CHardball(); bool Init(CDirect3D* pD3DWindow,CWindow* pWindow,HINSTANCE hInstance); CDirect3D* getD3D(); CWindow* getWindow(); void GameLoop(); protected: bool InitGame(); bool InitD3D(); void RenderText(); void Render2D(); void Render(); void Setup2DCamera(); CWindow* pWindow; CDirect3D* pD3D; class CPanel * m_pPanel1; DWORD m_dwFrames; DWORD m_dwStartTime; DWORD m_dwEndTime; DWORD m_dwTotalPolygons; };#endif
and now panel.h
#include "direct3d.h"#include "window.h"#define PANEL_D3DFVF_CUSTOMVERTEX (D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1)class CPanel{ public: CPanel(LPDIRECT3DDEVICE8 pD3DDevice, int nWidth, int nHeight, int nScreenWidth, int nScreenHeight, DWORD dwColour = -1); virtual ~CPanel(); bool setTexture(const char *szTextureFilePath, DWORD dwKeyColour = 0); DWORD Render(); void moveTo(int x,int y); protected: bool createVertices(); bool updateVertices(); LPDIRECT3DDEVICE8 m_pD3DDevice; LPDIRECT3DVERTEXBUFFER8 m_pVertexBuffer; LPDIRECT3DTEXTURE8 m_pTexture; int iWidth; int iHeight; int iScreenWidth; int iScreenHeight; DWORD dwColour; struct PANEL_CUSTOMVERTEX { float x, y, z; //Position of vertex DWORD colour; //Colour of vertex float u, v; //Texture coordinates };};#endif
Now in hardball.cpp add
#include "panel.h"
just under the
#include "hardball.h"
and in panel.cpp add
#include "hardball.h"
just under the
#include "panel.h"
This should solve your problem hopefully
EDIT - Fixed the code above, and noticed another solution - if you don't want to do all of the above then just delete the #include "hardball.h" from the panel.h file and put it in panel.cpp instead
[edited by - Grambo on July 27, 2002 6:24:52 AM]