The Q_OBJECT macro is missing in your header file
The Q_OBJECT macro is missing in your header file
Umm, I heard about that earlier. But where am I supposed to put this in the header file? All places where I try, new problems with the compiler arises. For example, if I put it exactly in line 19, the following error appears:
/home/martin/Documentos/Programas Qt/Servidor 3.4.3/menuwindows.cpp:6: error: undefined reference to `vtable for MenuWindows'
/home/martin/Documentos/Programas Qt/Servidor 3.4.3/menuwindows.cpp:6: error: undefined reference to `vtable for MenuWindows'
And how exaclty should I put it?
Qt Code:
{ Q_OBJECT public: ... }To copy to clipboard, switch view to plain text mode
if you are using qtcreator you can just recompile but if you are using a different IDE you need to use again qmake on your .pro file it depends on the IDE you are using
Well, I'm using Qt creator and I put the macro exactly in the place you (and the Help) indicates, but the problem persists. Here is the complete description of the problem:
moc_mytask.o moc_myserver.o moc_myclient.o -L/home/martin/QtSDK/Desktop/Qt/473/gcc/lib -L/usr/local/lib -lqwt-qt4 -lQtSvg -lQtGui -lQtNetwork -lQtCore -lpthread
menuwindows.o: In function `MenuWindows':
make: Saindo do diretório `/home/martin/Documentos/Programas Qt/Servidor 3.4.3'
/home/martin/Documentos/Programas Qt/Servidor 3.4.3/menuwindows.cpp:6: undefined reference to `vtable for MenuWindows'
/home/martin/Documentos/Programas Qt/Servidor 3.4.3/menuwindows.cpp:6: undefined reference to `vtable for MenuWindows'
collect2: ld returned 1 exit status
make: ** [Servidor] Erro 1
The process "/usr/bin/make" exited with code 2.
Error while building project Servidor (target: )
When executing build step 'Make'
It points to the cpp file.
In the build menu
1) Clean All
2) Run qmake
3) Rebuild all
Oh! Finally!
Thanks!
Bookmarks