0

I'm getting the undefined reference to vtable for CustomProgressBar' error when trying to launch following code:
customprogressbar.h

#ifndef CUSTOMPROGRESSBAR_H
#define CUSTOMPROGRESSBAR_H
#include <QProgressBar>
#include "task.h"

class CustomProgressBar : public QProgressBar
{
Q_OBJECT
public:
    CustomProgressBar(DayTask, QWidget* parent = 0);
protected:
    void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;

private:
    DayTask task;
};

#endif // CUSTOMPROGRESSBAR_H

customprogressbar.cpp

#include "customprogressbar.h"
#include <QPainter>

CustomProgressBar::CustomProgressBar(DayTask task, QWidget* parent) :
    task{task},
    QProgressBar(parent)
{

}
//paintevent

What could cause the problem?

Chechen Itza
  • 111
  • 8
  • 1
    Possible duplicate of [Undefined reference to vtable](http://stackoverflow.com/questions/3065154/undefined-reference-to-vtable) – Lasse Meyer Jul 29 '16 at 10:40
  • For further readers, this seems to be an issue becaus the `paintEvent` method is virtual and declared but not defined. – maxik Jul 29 '16 at 20:12

1 Answers1

1

Maybe moc (meta object compiler) is not being run for your header? Anyway, it's duplicate for this question

Community
  • 1
  • 1
And-y
  • 66
  • 4