[Qt]qmake and updating makefile
-
Hello,
I bought the book "Prentice Hall PTR: C++ GUI Programming with Qt 3". There's a chapter 2 (Subclassing dialogs) and there's the following text:Visual C++'s output starts like this:
finddialog.obj : error LNK2001: unresolved external symbol
"public:~virtual bool __thiscall FindDialog::qt_property(int,
int,class QVariant *)"If this ever happens to you, run qmake again to update the makefile, then rebuild the application.
I tried that few times but it doesn't working at all. My Visual Studio gives exatly such an error.
How I tried:
Start->Run->cmd - gone to the "qmake"-directory and typed in "qmake.exe -tp vc findDialog/dialog.pro", everything seems to be ok, but if I want rebuild in vstudio the same errors are caming again! What's wrong or was it my fault? Please help me to fix this problem
Here my SourceCode:#include<qapplication.h> #include<qcheckbox.h> #include<qlabel.h> #include<qlayout.h> #include<qlineedit.h> #include<qpushbutton.h> #ifndef FINDDIALOG_H #define FINDDIALOG_H #include<qdialog.h> class QCheckBox; class QLabel; class QLineEdit; class QPushbutton; class FindDialog : public QDialog { Q_OBJECT public: FindDialog(QWidget *parent = 0, const char *name = 0); signals: void findNext(const QString &str, bool CaseSensitive); void findPrev(const QString &str, bool CaseSensitive); private slots: void findClicked(); void enableFindButton(const QString &text); private: QLabel *label; QLineEdit *lineEdit; QCheckBox *caseCheckBox; QCheckBox *backwardCheckBox; QPushButton *findButton; QPushButton *closeButton; }; #endif FindDialog::FindDialog(QWidget *parent, const char *name) : QDialog(parent, name) { setCaption(tr("Find")); label = new QLabel(tr("Find &what:"), this); lineEdit = new QLineEdit(this); label->setBuddy(lineEdit); caseCheckBox = new QCheckBox(tr("Match &case"), this); backwardCheckBox = new QCheckBox(tr("Search &backward"), this); findButton = new QPushButton(tr("&Find"), this); findButton->setDefault(true); findButton->setEnabled(false); closeButton = new QPushButton(tr("Close"), this); connect(lineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(enableFindButton(const QString &))); connect(findButton, SIGNAL(clicked()), this, SLOT(findClicked())); connect(closeButton, SIGNAL(clicked()), this, SLOT(close())); QHBoxLayout *topLeftLayout = new QHBoxLayout; topLeftLayout->addWidget(label); topLeftLayout->addWidget(lineEdit); QVBoxLayout *leftLayout = new QVBoxLayout; leftLayout->addLayout(topLeftLayout); leftLayout->addWidget(caseCheckBox); leftLayout->addWidget(backwardCheckBox); QVBoxLayout *rightLayout = new QVBoxLayout; rightLayout->addWidget(findButton); rightLayout->addWidget(closeButton); rightLayout->addStretch(1); QHBoxLayout *mainLayout = new QHBoxLayout(this); mainLayout->setMargin(11); mainLayout->setSpacing(6); mainLayout->addLayout(leftLayout); mainLayout->addLayout(rightLayout); } void FindDialog::findClicked() { QString text = lineEdit->text(); bool caseSensitive = caseCheckBox->isOn(); if(backwardCheckBox->isOn()) emit findPrev(text, caseSensitive); else emit findNext(text, CaseSensitive); } void FindDialog::enableFindButton(const QString &text) { findButton->setEnabled(!text.isEmpty()); } int main(int argc, char *argv[]) { QApplication app(argc, argv); FindDialog *dialog = new FindDialog; app.setMainWidget(dialog); dialog->show(); return app.exec(); }