PDA

View Full Version : New to QT FindDialog not building



nico.callewaert
12th August 2010, 09:15
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>

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();
}



Any help is much appreciated,
Thanks a lot !!
Nico

tbscope
12th August 2010, 09:21
Did you include finddialog.h in your cpp file?

nico.callewaert
12th August 2010, 09:25
Hi !

Thanks for the quick reply. Yes, it is included.
The files are on the home computer, maybe I better pasted the complete contents, sorry....

Thanks !
N.