Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Error while calling other class.
Qt 6.11 is out! See what's new in the release blog

Error while calling other class.

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 552 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Meera Hadid
    wrote on last edited by
    #1
    • I am getting an error when I am trying to call another class(ImportDICOMBrowser) in qSlicerMainWindow through on_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"
    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Meera-Hadid said in Error while calling other class.:

      ImportDICOMBrowser.cxx

      Do you actually compile this source when building your application?

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      M 1 Reply Last reply
      0
      • Christian EhrlicherC Christian Ehrlicher

        @Meera-Hadid said in Error while calling other class.:

        ImportDICOMBrowser.cxx

        Do you actually compile this source when building your application?

        M Offline
        M Offline
        Meera Hadid
        wrote on last edited by
        #3

        @Christian-Ehrlicher I didn't understand your question, can you please elaborate.

        JonBJ 1 Reply Last reply
        0
        • M Meera Hadid

          @Christian-Ehrlicher I didn't understand your question, can you please elaborate.

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #4

          @Meera-Hadid
          @Christian-Ehrlicher is asking you when and how ImportDICOMBrowser.cxx gets compiled during your build process? For qSlicerMainWindow to call anything about class ImportDICOMBrowser that will need compiling and linking with your qSlicerMainWindow stuff.

          1 Reply Last reply
          1

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved