Hello, this is a terminal application i'm trying to make:
#include <QtCore/QTimer>
#include <QCoreApplication>
#include <QtCore/QObject>
#include <QtCore/QDebug>
{
Q_OBJECT
public:
public slots:
void check() {
qDebug() << "i am going through the check() function right now!\n";
}
};
int main(int argc, char *argv[])
{
QObject::connect(timer,
SIGNAL(timeout
()),
new checker
(timer
),
SLOT(checker
::check()));
timer->start(1000);
return a.exec();
}
#include <QtCore/QTimer>
#include <QCoreApplication>
#include <QtCore/QObject>
#include <QtCore/QDebug>
class checker : public QObject
{
Q_OBJECT
public:
checker(QObject * o = 0) : QObject(o) {}
public slots:
void check() {
qDebug() << "i am going through the check() function right now!\n";
}
};
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QTimer * timer = new QTimer;
QObject::connect(timer, SIGNAL(timeout()),new checker(timer), SLOT(checker::check()));
timer->start(1000);
return a.exec();
}
To copy to clipboard, switch view to plain text mode
I get this error:
error: undefined reference to `vtable for checker'
error: undefined reference to `vtable for checker'
To copy to clipboard, switch view to plain text mode
Can anybody explain me why?
Thanks a lot!
Bookmarks