undefined reference to vtable `...SomeClass...`
It frustrates me at first. I still don't know why it happens, but I know how to solve it in my case.
As an example, this code:
#include <QObject> #include <stdio.h> class HelloWorld : public QObject { Q_OBJECT signals: void done(); public slots: void sayHello() { printf("Hello World!\n"); done(); } };
works fine when put into helloworld.h and called by main.cpp.
However, when it's put directly into main.cpp... it throws the (linker) error.
It seems all Qt objects must be put into their own H/CPP pair. At least that's what it makes me think.
Reference: qt-interest mailing list archive - undefined reference to vtable...
No comments:
Post a Comment
Be the first to comment!