Q_OBJECT throwing 'undefined reference to vtable' error [duplicate]
问题 This question already has answers here : Qt Linker Error: “undefined reference to vtable” [duplicate] (9 answers) Closed 6 years ago . I\'m using Qt Creator 2.0.1 with Qt 4.7.0 (32 bit) on Windows 7 Ultimate 32 bit. Consider the following code, which is a minimum to produce the error: class T : public QObject, public QGraphicsItem { Q_OBJECT public: T() {} QRectF boundingRect() const {return QRectF();} void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) {} }