[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’
- #ifndef REQUESTPOST_H
- #define REQUESTPOST_H
- #include <QObject>
- #include <QtNetwork/QNetworkRequest>
- #include <QtNetwork/QNetworkReply>
- #include <QtNetwork/QNetworkAccessManager>
- #include <QUrl>
- class RequestPost:public QObject
- // Q_OBJECT
- QIODevice *networkReply() const;
- QNetworkReply *reply;
- QNetworkAccessManager *manager;
- 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.
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.