convert c++ class to qt class
hope someone can help with this. There's a c++ class in my qt code that I need to turn into a qt class ( sorry don't know correct term ). As I need to pass a signal from it. I've tried but get some errors to do with "vtables".
What I did was add #include <QObject> to my class header, changed the way the class is declared and the way the constructor is declared so in header I've replaced
class Bonus_Class : public QObject
explicit Bonus_Class(QObject *parent = 0);
then I've replace the constructor in my code with
Bonus_Class::Bonus_Class(QObject *parent) :QObject(parent)
However this gives a vtable error, not sure what this is.
/bonus_class.cpp:11: error: undefined reference to
vtable for Bonus_Class' /bonus_class.h:95: error: undefined reference tovtable for Bonus_Class'
can anyone advise, I'm sure this is simple but I'm not used to QT. Thanks
Try to run qMake , than rebuild.
No need to change the constructor if your class does not need a parent.
Run qmake and rebuild your project.
Thankyou all qmake worked