I was wondering why I was getting this error: undefined reference to `vtable for BaseRenderer'
I tried searching around but cannot seem to figure this out. I've tried getting rid of the virtual function, removing the constructor, etc.
My BaseRenderer.h
class BaseRenderer : public Renderer
{
Q_OBJECT
public:
BaseRenderer();
BaseRenderer(QWidget *parent);
void paintGL();
virtual ~BaseRenderer();
public slots:
void loadDialog();
signals:
protected:
Mesh loadMesh(string fileName);
private:
OBJParser objParser;
Mesh baseTerrain;
};
My BaseRenderer.cpp
BaseRenderer::BaseRenderer() <------ Error leads me here
{
}
BaseRenderer::BaseRenderer(QWidget *parent) : Renderer(parent)
{
}
BaseRenderer::~BaseRenderer()
{
//dtor
}
How would I go about getting rid of this issue? I also hear it may be the compiler...? Thanks for the help :)
Since Q_OBJECT is in the parent class, Renderer, you don't have to also include it BaseRenderer. Just get rid of Q_OBJECT and it should work :)
See 'What does it mean that the "virtual table" is an unresolved external?' in the C++ FAQ Lite.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With