Undefined reference to vtable error
-
I was building a program as I usually do, but for some reason, I can't get beyond this error. Here is my code:
http://pastebin.com/YfKc0McZ - Player.h
http://pastebin.com/Ucm0uByn - Player.cppAny ideas on why this happens?
-
ahh, add Q_OBJECT to your object ?
like
class MainWindow : public QMainWindow
{
Q_OBJECT
..then clean and rebuild all.
-
@mrjj Thanks for the quick answer! I don't recall needing that, but when I add it, the whole thing gets worse with it complaining about protected classes and such.
EDIT: In my previous game, it was exactly like that and there was no problem -
Hi,
When adding/removing Q_OBJECT you need to re-run qmake before building, or do a full clean build.
-
To add to @hskoglund you have QGraphicsObject if you need QObject features
-
@hskoglund By inhereting from QWidget I get the same error 3 times. Also, my last project inherited from QGraphicsPixmapItem and had no problem when the code was like this. Any ideas why?
-
sorry my bad, I read it as QWidget.
Not sure you need Q_OBJECT for QGraphicsRectItem -
Deleted the project, ran it on the laptop and everything seems fine now... I will look into it to see what the issue was, maybe there is something missing somewhere