Link to home
Start Free TrialLog in
Avatar of Cheney
Cheney

asked on

undefined reference to vtable...

I get this linker error when I try to compile my app (using MinGW inside the eclipse IDE)

"undefined reference to 'vtable for CD3DXModel"

The affect files are:

==========================================================
CModel.h
==========================================================
#ifndef CHENEY_CMODEL_INCLUDED
#define CHENEY_CMODEL_INCLUDED

#include <d3dx9.h>

#include "Debug.h"
#include "CCamera.h"

class CModel
{
      protected:
            LPDIRECT3DDEVICE9      m_pD3DDevice;
            D3DXMATRIX                  m_mtxWorld;
            float                        m_fSphereSize;
            
      public:
            virtual void Render(CCamera*){DEBUG("[CModel] Render should be called by inherited class!");}
            virtual bool Collided(CModel *){DEBUG("[CModel] Collided should be called by inherited class!"); return false;}
            virtual void Update(DWORD){DEBUG("[CModel] Update should be called by inherited class!");}
            virtual void Release(){DEBUG("[CModel] Release should be called by inherited class!");}
};

#endif //CHENEY_CMODEL_INCLUDED


==========================================================
CD3DXModel.h
==========================================================
#ifndef CHENEY_CD3DXMODEL_INCLUDED
#define CHENEY_CD3DXMODEL_INCLUDED

#include <d3dx9.h>
#include "Debug.h"
#include "CModel.h"
#include "CCamera.h"
#include "CMaterial.h"

class CD3DXModel : public CModel
{
      protected:
            LPD3DXMESH            m_pMesh;
            LPD3DXBUFFER      m_pAdjBuffer;
            LPD3DXBUFFER      m_pSubSetBuffer;
            LPD3DXBUFFER      m_pEffectBuffer;
            DWORD                  m_dwAttributes;
            CMaterial            **m_pMaterials;
            
      public:
            CD3DXModel();
            
            // CModel
            void Render(CCamera*);
            void Collided(){TRACE("[CD3DXModel] Collided not yet implemented");}
            void Update(DWORD elapsed){}
            void Release();
            
            // CModelManager access
            friend class CModelManager;
};


#endif //CHENEY_CD3DXMODEL_INCLUDED

==========================================================
CD3DXModel.cpp
==========================================================
#include "CD3DXModel.h"

//=============================================================================
// Constructor
//=============================================================================
CD3DXModel::CD3DXModel()
{
      // Init memebers
      //m_pD3DDevice = 0;
      m_pMesh = 0;
      m_pAdjBuffer = 0;
      m_pSubSetBuffer = 0;
      m_pEffectBuffer = 0;
      m_pMaterials = 0;
      m_dwAttributes = 0;
      //m_fSphereSize = 0.0f;
      //D3DXMatrixIdentity(&m_mtxWorld);
}



The error occurs in CD3DXModel.cpp just after the line "CD3DXModel::CD3DXModel()".

I also noticed that if I link the app without having CD3DXModel inherit from CModel it links without any problems... (but I need it to inherit)

Any ideas?
ASKER CERTIFIED SOLUTION
Avatar of AlexFM
AlexFM

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Cheney
Cheney

ASKER

Wow! I feel dumb!

I usually use the microsoft compiler and it doesn't complain unless you call a function that isnt implemented...