QObject question please, it’s simple but I can’t get it!!
I have a question about writing QObject in the main.cpp file, it’s seems like a trivial task, but I can’t believe it, I can’t get it to work, and I don’t know what I miss in this trivial program.
I’ve tried to put it before the main method but it’s not working, so I’ve putted after the main method with class forward declaration but also it’s not working.
with vtable reference error.
I’ve also tried to put all methods inside the class including the signal but having no luck at all.
do I miss something in QObject implementation? although I’ve read the QObject details many times.
Or it’s a problem with QT Creator.
You can replicate this problem easily.
Thanks in Advance
error: main.moc: No such file or directory
Did you run qmake again?
sorry for that but the solution doesn’t work with the above message.
- anselmo@skadi ~/projects/Qt/devnet/project $ ls
- main.cpp project.pro
- TEMPLATE = app
- TARGET =
- DEPENDPATH += .
- INCLUDEPATH += .
- # Input
- SOURCES += main.cpp
project is the binary. Attention to the first line of the compilation output, there you can see moc being called to generate main.moc.