[SOLVED]QObject subclass compile error
-
Hi all,
I cannot see the problem within this class:@
class TableViewHandler : public QObject
{
Q_OBJECT
public:
TableViewHandler( QObject* parent = 0 );
...
}// implementation
TableViewHandler::TableViewHandler( QObject* parent) : QObject(parent) {
// do stuff
}
@which I cannot compile getting the error:
@tableviewhandler.o: In function
TableViewHandler': /sviluppo/c/WHR-build-desktop/../WHR/tableviewhandler.cpp:5: undefined reference to
vtable for TableViewHandler'
/sviluppo/c/WHR-build-desktop/../WHR/tableviewhandler.cpp:5: undefined reference tovtable for TableViewHandler' tableviewhandler.o: In function
~TableViewHandler':
/sviluppo/c/WHR-build-desktop/../WHR/tableviewhandler.cpp:31: undefined reference tovtable for TableViewHandler' /sviluppo/c/WHR-build-desktop/../WHR/tableviewhandler.cpp:31: undefined reference to
vtable for TableViewHandler'
/sviluppo/c/WHR-build-desktop/../WHR/tableviewhandler.cpp:31: undefined reference tovtable for TableViewHandler' collect2: ld returned 1 exit status make: Leaving directory
/sviluppo/c/WHR-build-desktop'
make: *** [WHR] Error 1
The process "/usr/bin/make" exited with code 2.
Error while building project WHR (target: Desktop)
When executing build step 'Make'@no matter what my constructor does. Any suggestion?
-
Clean the project and re-run qmake.
That should do the trick.
-
...and ran qmake? I usually get those errors when the generated moc files no longer matches the class as it is now. I would also recommend manually deleting all generated files.
A clean alone does not remove the generated files, nor does it cause qmake to run.