Friday, November 13, 2015

Qt: "undefined reference to vtable" while inheriting from QObject

Linker' error "undefined reference to vtable" in QT 5.5.1 (Linux-64 g++ 4.8) can be fixed by doing both these things:
a) rm - rf /*
(e.g. /build-myapp-Desktop_Qt_5_5_1_GCC_64bit)
b) moving the QObject definition in .h file next to public / private keyword, i.e. instead of

class Abc : public AnotherClass, QObject

make it

class Abc : public QObject, AnotherClass

Once done, rebuild the project.

No comments: