Hi,
I'm completely new to QT and I'm trying to enter an example from the book "C++ GUI Programming with QT 4". I'm using Codeblocks as IDE. However I receive the following error :
obj\Debug\main.o||In function `main'
C:\Qt_Projects\FindDialog\main.cpp|12|undefined reference to `FindDialog::FindDialog(QWidget*)'|
||=== Build finished: 1 errors, 0 warnings ===|
I'm already looking hours at the syntax, but I can't see anything wrong.
Here is the contents of the header file :
#ifndef FINDDIALOG_H
#define FINDDIALOG_H
#include <QDialog>
{
Q_OBJECT
public:
signals:
void findNext
(const QString &str, Qt
::CaseSensitivity cs
);
void findPrevious
(const QString &str, Qt
::CaseSensitivity cs
);
private slots:
void findClicked();
void enableFindButton
(const QString &text
);
private:
};
#endif // FINDDIALOG_H
The first lines of the class definition of the .cpp file :
FindDialog
::FindDialog(QWidget *parent
){
......
}
and the main file :
#include <QApplication>
#include "finddialog.h"
int main(int argc, char* argv[])
{
FindDialog *dialog = new FindDialog; <<<<<<-- Error here
dialog->show();
return app.exec();
}
#ifndef FINDDIALOG_H
#define FINDDIALOG_H
#include <QDialog>
class QCheckBox;
class QLabel;
class QLineEdit;
class QPushButton;
class FindDialog : public QDialog
{
Q_OBJECT
public:
FindDialog(QWidget *parent = 0);
signals:
void findNext(const QString &str, Qt::CaseSensitivity cs);
void findPrevious(const QString &str, Qt::CaseSensitivity cs);
private slots:
void findClicked();
void enableFindButton(const QString &text);
private:
QLabel *label;
QLineEdit *lineEdit;
QCheckBox *caseCheckBox;
QCheckBox *backwardCheckBox;
QPushButton *findButton;
QPushButton *closeButton;
};
#endif // FINDDIALOG_H
The first lines of the class definition of the .cpp file :
FindDialog::FindDialog(QWidget *parent)
: QDialog(parent)
{
......
}
and the main file :
#include <QApplication>
#include "finddialog.h"
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
FindDialog *dialog = new FindDialog; <<<<<<-- Error here
dialog->show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Any help is much appreciated,
Thanks a lot !!
Nico
Bookmarks