[Solved]Q_OBJECT and vtable
When i put QObject in my H file I got this message
:/requestpost.cpp:4: undefined reference to `vtable for RequestPost’
My headerFile
- #ifndef REQUESTPOST_H
- #define REQUESTPOST_H
- #include <QObject>
- #include <QtNetwork/QNetworkRequest>
- #include <QtNetwork/QNetworkReply>
- #include <QtNetwork/QNetworkAccessManager>
- #include <QUrl>
- {
- // Q_OBJECT
- public:
- RequestPost();
- private:
- private slots:
- void finishedSlot();
- };
- #endif // REQUESTPOST_H
I have done in a similar way a lots of times earlier and never got this problem.
Anyone who could tell me why this problem appers in this class declaration.
4 replies
I’ve never seen Q_OBJECT under comment.
Normally, you can resolve such issues by cleaning the project, then running qmake, and then rebuild.
If you want to be more specific, it should be enough to manually delete all generated files for that class – that is, the corresponding moc-File (if one even existed), and the corresponding object files, and then run qmake and build the project.
You must log in to post a reply. Not a member yet? Register here!



