Error while calling other class.
Unsolved
General and Desktop
-
- I am getting an error when I am trying to call another class(
ImportDICOMBrowser
) inqSlicerMainWindow
throughon_LoadAction_triggered
action.
#include "importdicombrowser.h"
void qSlicerMainWindow::on_LoadAction_triggered() { ImportDICOMBrowser* temp = new ImportDICOMBrowser(this); temp->show(); }
ImportDICOMBrowser.h
#ifndef IMPORTDICOMBROWSER_H #define IMPORTDICOMBROWSER_H #include <QDialog> namespace Ui { class ImportDICOMBrowser; } class ImportDICOMBrowser : public QDialog { Q_OBJECT public: explicit ImportDICOMBrowser(QWidget *parent = nullptr); ~ImportDICOMBrowser(); private: Ui::ImportDICOMBrowser *ui; }; #endif // IMPORTDICOMBROWSER_H
ImportDICOMBrowser.cxx
#include "importdicombrowser.h" #include "ui_importdicombrowser.h" ImportDICOMBrowser::ImportDICOMBrowser(QWidget *parent) : QDialog(parent), ui(new Ui::ImportDICOMBrowser) { ui->setupUi(this); } ImportDICOMBrowser::~ImportDICOMBrowser() { delete ui; }
- ERROR:
Error LNK2019 unresolved external symbol "public: __cdecl ImportDICOMBrowser::ImportDICOMBrowser(class QWidget *)" (??0ImportDICOMBrowser@@QEAA@PEAVQWidget@@@Z) referenced in function "public: void __cdecl qSlicerMainWindow::on_LoadAction_triggered(void)" (?on_LoadAction_triggered@qSlicerMainWindow@@QEAAXXZ)
- I am not able to understand why is it showing
ImportDICOMBrowser
as an external variable, I also included the hearder file#include "importdicombrowser.h"
- I am getting an error when I am trying to call another class(
-
@Meera-Hadid said in Error while calling other class.:
ImportDICOMBrowser.cxx
Do you actually compile this source when building your application?
-
@Christian-Ehrlicher I didn't understand your question, can you please elaborate.
-
@Meera-Hadid
@Christian-Ehrlicher is asking you when and howImportDICOMBrowser.cxx
gets compiled during your build process? ForqSlicerMainWindow
to call anything about classImportDICOMBrowser
that will need compiling and linking with yourqSlicerMainWindow
stuff.