Hey I've got a really simple qt program that doesn't seem to compile. The error I get is "symbol(s) not found for architecture x86_64" and "linker command failed with exit code 1(use -v to see invocation)". PS: i use a mac os X version 10.9.2. I tried making the destructor virtual and putting the class in a separate header file. Neither worked.
Error:
Undefined symbols for architecture x86_64:
"vtable for QQ", referenced from:
QQ::QQ(QWidget*) in main.o
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Test.app/Contents/MacOS/Test] Error 1
14:42:46: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project Test (kit: Desktop Qt 5.2.1 clang 64bit)
When executing step 'Make'
Here is my code:
#include "qmainwindow.h"
#include <QApplication>
#include <QPushButton>
#include <QObject>
#include <iostream>
#include <QTextEdit>
#include <QVBoxLayout>
using namespace std;
class QQ: public QWidget{
Q_OBJECT
public:
explicit QQ(QWidget* parent = 0) { };
virtual ~QQ() { };
void print(){cout << value;};
public slots:
void changev(int n){value = 135;};
private:
int value;
};
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
QMainWindow mw;
QQ* a = new QQ(&mw);
//QPushButton* qp = new QPushButton("here");
//QObject::connect(qp, SIGNAL(clicked()), a, SLOT(changev(9)));
return app.exec();
}