-1

I am trying to call and show other window in mainwindow in Qt Creator. This below its my code:

ImageDialog imageDialog;
imageDialog->show();

but this is wrong and I see this error from Qt:

mainwindow.obj:-1: error: LNK2019: unresolved external symbol "public: __cdecl ImageDialog::ImageDialog(class QWidget *)" (??0ImageDialog@@QEAA@PEAVQWidget@@@Z) referenced in function "private: void __cdecl MainWindow::on_pushButton_4_clicked(void)" (?on_pushButton_4_clicked@MainWindow@@AEAAXXZ)

screenshot

Dimitri Podborski
  • 3,714
  • 3
  • 19
  • 31
Sina
  • 15
  • 5
  • 1
    Where is ImageDialog defined? - is that a Qt library?, maybe you can display some more code + the .pro file? – code_fodder Jun 20 '16 at 09:30
  • Thank You All. i will fixed my problem with This: ImageDialog *dialog = new ImageDialog; dialog->setWindowTitle("Dialog"); dialog->show(); and add MainWindow header tags into ImageDialog and Reverse. and finaly i'am Run QMake. – Sina Jun 20 '16 at 17:34

1 Answers1

1

The problem is, you declared ImageDialog constructor (which takes QWidget * as parameter) and didn't provide definition.

You should probably add definition to your imagedialog.cpp like

ImageDialog::ImageDialog(QWidget * parent)
    : YOUR_IMAGE_DIALOG_BASE_CLASS_NAME(parent)
{
}
V. Kravchenko
  • 1,859
  • 10
  • 12