i have this issue with slots and signals in visual studio 2012 with Qt plugin. When i compile the qt project, it shows the error:
moc_mainwindow.obj : error LNK2019: unresolved external symbol "public: void __thiscall MainWindow::onUpdate(class QString)" (?onUpdate@MainWindow@@QAEXVQString@@@Z) referenced in function "private: static void __cdecl MainWindow::qt_static_metacall(class QObject *,enum QMetaObject::Call,int,void * *)" (?qt_static_metacall@MainWindow@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z)
these are my classes:
mainwindow.h
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QTextEdit>
#include <QString>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
public slots:
void onUpdate(QString info);
private:
Ui::MainWindow *ui;
QTextEdit *textEdit;
};
#endif // MAINWINDOW_H
mainwindow.cpp
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QString>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
MainWindow::onUpdate(QString info) {
//ui->textEdit->append(info);
}
some help? thanks in advance!