I can't open a new window/dialog form mainwindow in qt project.
Open function:
void MainWindow::on_btDodajProdukt_clicked()
{
newDialog = new DodajProdukt(this);
newDialog->show();
}
MainWindow includes:
#include "dodajprodukt.h"
MainWindow.h
DodajProdukt *newDialog;
Class DodajProdukt is new Window added in desinger.
I get this error:
mainwindow.obj:-1: błąd:LNK2019: unresolved external symbol "public: __thiscall DodajProdukt::DodajProdukt(class QWidget *)" (??0DodajProdukt@@QAE@PAVQWidget@@@Z) referenced in function "private: void __thiscall MainWindow::on_btDodajProdukt_clicked(void)" (?on_btDodajProdukt_clicked@MainWindow@@AAEXXZ)
EDIT:
dodajprodukt.cpp
#include "dodajprodukt.h"
#include "ui_dodajprodukt.h"
DodajProdukt::DodajProdukt(QWidget *parent) :
QDialog(parent),
ui(new Ui::DodajProdukt)
{
ui->setupUi(this);
}
DodajProdukt::~DodajProdukt()
{
delete ui;
}
Pro File:
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = Hurtownia
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp \
dodajprodukt.cpp \
listaproduktow.cpp
HEADERS += mainwindow.h \
dodajprodukt.h \
listaproduktow.h
FORMS += mainwindow.ui \
dodajprodukt.ui \
listaproduktow.ui
dodajprodukt.cpp
file with the window's implementation that you're not linking with your project. – Kos