Thank you for your answer. Now it says:
Error 1 error LNK2019: unresolved external symbol "public: __thiscall AnalogClock::AnalogClock(class QWidget *)" (??0AnalogClock@@QAE@PAVQWidget@@@Z) referenced in function "public: void __thiscall Ui_Dialog::setupUi(class QDialog *)" (?setupUi@Ui_Dialog@@QAEXPAVQDialog@@@Z) main.obj
Error 2 fatal error LNK1120: 1 unresolved externals debug\pp.exe
My code is:
main.cpp
#include <QApplication>
#include <QDialog>
#include "ui_form.h"
int main(int argc,char *argv[])
{
Ui::Dialog ui;
ui.setupUi(dialog);
dialog->show();
return app.exec();
}
#include <QApplication>
#include <QDialog>
#include "ui_form.h"
int main(int argc,char *argv[])
{
QApplication app(argc, argv);
Ui::Dialog ui;
QDialog *dialog = new QDialog;
ui.setupUi(dialog);
dialog->show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
ui_form.h
#ifndef UI_FORM_H
#define UI_FORM_H
#include <QtCore/QVariant>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QDialog>
#include "analogclock.h"
class Ui_Dialog
{
public:
AnalogClock *analogClock;
{
Dialog
->setObjectName
(QString::fromUtf8("Dialog"));
Dialog
->resize
(QSize(400,
300).
expandedTo(Dialog
->minimumSizeHint
()));
analogClock = new AnalogClock(Dialog);
analogClock
->setObjectName
(QString::fromUtf8("analogClock"));
analogClock
->setGeometry
(QRect(170,
140,
100,
100));
retranslateUi(Dialog);
} // setupUi
void retranslateUi
(QDialog *Dialog
) {
analogClock
->setWhatsThis
(QApplication::translate("Dialog",
"The analog clock widget displays the current time.",
0,
QApplication::UnicodeUTF8));
Q_UNUSED(Dialog);
} // retranslateUi
};
namespace Ui {
class Dialog: public Ui_Dialog {};
} // namespace Ui
#endif // UI_FORM_H
#ifndef UI_FORM_H
#define UI_FORM_H
#include <QtCore/QVariant>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QDialog>
#include "analogclock.h"
class Ui_Dialog
{
public:
AnalogClock *analogClock;
void setupUi(QDialog *Dialog)
{
Dialog->setObjectName(QString::fromUtf8("Dialog"));
Dialog->resize(QSize(400, 300).expandedTo(Dialog->minimumSizeHint()));
analogClock = new AnalogClock(Dialog);
analogClock->setObjectName(QString::fromUtf8("analogClock"));
analogClock->setGeometry(QRect(170, 140, 100, 100));
retranslateUi(Dialog);
QMetaObject::connectSlotsByName(Dialog);
} // setupUi
void retranslateUi(QDialog *Dialog)
{
Dialog->setWindowTitle(QApplication::translate("Dialog", "Dialog", 0, QApplication::UnicodeUTF8));
analogClock->setToolTip(QApplication::translate("Dialog", "The current time", 0, QApplication::UnicodeUTF8));
analogClock->setWhatsThis(QApplication::translate("Dialog", "The analog clock widget displays the current time.", 0, QApplication::UnicodeUTF8));
Q_UNUSED(Dialog);
} // retranslateUi
};
namespace Ui {
class Dialog: public Ui_Dialog {};
} // namespace Ui
#endif // UI_FORM_H
To copy to clipboard, switch view to plain text mode
Bookmarks