qt - undefined reference to `vtable for myObj' in qt console application - signals and slots
-
Hi, the Q_OBJECT macro in your class declaration needs to be processed by the moc compiler. Easiest is to move your class declaration into your main.h.
EDIT: forgot probably you don't have a main.h yet, if so, just create it and put the class declaration inside it. And don't forget to #include main.h in your main.cpp :-) -
Hi CybeX,
I have experimented your program. All the syntax are perfect, there is a issue with CLASS name (myObj).
with class name myObj i m getting linker error.
But by changing the class name and building there is no error. So may be there is some dependency issue with class name myObj.
change it to myObj1 and try. -
@Devopia53
Thank for correcting.But after adding #include "main.moc", (run qmake is also done) following error while building.
Error: dependent 'debug\main.moc' does not exist.
-
Hi,
If you really want to use that technique, the moc include should be the last line of
main.cpp
file