I'm getting the error "reference undefined to "vtable for FlussoAudio" in this code, i can't find a reason for this error.
FlussoAudio.cpp
#include <QtGui>
#include <QWidget>
#include "FlussoAudio.h"
FlussoAudio::FlussoAudio(QWidget *parent)
: QWidget(parent)
{
//...Buttons and Layout...
setWindowTitle(tr("Lettore Audio"));
resize(500,400);
}
FlussoAudio.h
#ifndef FLUSSOAUDIO_H
#define FLUSSOAUDIO_H
#include <QWidget>
class FlussoAudio : public QWidget
{
Q_OBJECT
public:
explicit FlussoAudio (QWidget *parent = 0);
};
#endif
Main.cpp
#include <QApplication>
#include "FlussoAudio.h"
int main (int argc, char *argv[])
{
QApplication app(argc,argv);
FlussoAudio Audio;
Audio.show();
return app.exec();
}
The Build messages are these:
/FlussoAudio.cpp|10|reference undefined to "vtable for FlussoAudio"|
/FlussoAudio.cpp|10|reference undefined to "vtable for FlussoAudio"|
/FlussoAudio.h|10|reference undefined to "FlussoAudio::staticMetaObject"|
/FlussoAudio.h|8|reference undefined to "vtable for FlussoAudio"|
/FlussoAudio.h|8|reference undefined to "vtable for FlussoAudio"|
I'm using codeblocks and g++ on Arch Linux.
The macro Q_OBJECT is mean, if not used in a moc compilation. Erase the line or comment it // Q_OBJECT
Regarding moc: http://harmattan-dev.nokia.com/docs/library/html/qt4/moc.html