/MyFolder/main.o:: In function 'MyDialog': /MyFolder/main.cpp:4: error: undefined reference to 'vtable for MyDialog' /MyFolder/main.o:: In function '~MyDialog': /MyFolder/main.cpp:4: error: undefined reference to 'vtable for MyDialog' collect2: ld returned 1 exit status
Operating system(s) or programming environment(s)
Ubuntu 10.10 (maverick)
Qt Creator 2.0.0
- G++ 4.4.5
Libraries used:
Qt project file: CppLinkErrorUndefinedReferenceToVtableForMyDialog.pro
#------------------------------------------------- # # Project created by QtCreator 2010-12-29T14:26:41 # #------------------------------------------------- QT += core QT -= gui TARGET = CppLinkErrorUndefinedReferenceToVtableForMyDialog CONFIG += console CONFIG -= app_bundle TEMPLATE = app SOURCES += main.cpp
#include <QObject> class MyDialog : public QObject { Q_OBJECT public slots: void onSomething() { } }; int main() { MyDialog dialog; }
Seperate the MyDialog class in a header (.h) file and an implementation (.cpp) file.



