qt - undefined reference to `vtable for myObj' in qt console application - signals and slots
-
wrote on 25 Jan 2017, 03:09 last edited by hskoglund
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 :-) -
wrote on 25 Jan 2017, 04:12 last edited by yuvaram
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. -
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. -
wrote on 25 Jan 2017, 06:37 last edited by
@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.
-
@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 -
wrote on 26 Jan 2017, 01:28 last edited by
Hi ,
main.moc file is not generating. -
@yuvaram
Hi
For less pain. just use a .h file. :)Delete the build folder and rebuild all.
-
wrote on 26 Jan 2017, 07:45 last edited by
If so, compile it with Network Download Example, which is officially available from Qt.
-
This post is deleted!