Qt 6.11 is out! See what's new in the release
blog
Error while calling other class.
-
- I am getting an error when I am trying to call another class(
ImportDICOMBrowser) inqSlicerMainWindowthroughon_LoadAction_triggeredaction.
#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_HImportDICOMBrowser.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
ImportDICOMBrowseras 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?
-
@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.
-
@Christian-Ehrlicher I didn't understand your question, can you please elaborate.
@Meera-Hadid
@Christian-Ehrlicher is asking you when and howImportDICOMBrowser.cxxgets compiled during your build process? ForqSlicerMainWindowto call anything about classImportDICOMBrowserthat will need compiling and linking with yourqSlicerMainWindowstuff.