When using qtcreator, inherit a QWidget class
class xxx:public QWidget
{
Q_ OBJECT
explicit xxx(QWidget* parent=0);
};
Then, undefined reference to ` VTable for XXX:: XXX appears in build
Solution: turn off the qtreactor in order not to destroy some structures
Then enter the directory where the program is stored to execute
qmake xxx.pro
Then open qtreactor to build, and the error disappears