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. Problems with linking files

Problems with linking files

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 4 Posters 1.3k Views 1 Watching
  • 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.
  • C Offline
    C Offline
    ChusMatesanz
    wrote on last edited by
    #1

    Hello to everyone.
    I am still a beginner in Qt and I have some problems in linking the different files of the project.
    I am just copying the Qt Simple Tree Model Example. The only change I made was introducing a MainWindow, with its header, to organize the application.
    However, I have the following errors :
    mainwindow.obj:-1: error: LNK2019: unresolved external symbol "public: __cdecl TreeModel::TreeModel(class QString const &,class QObject *)" (??0TreeModel@@QEAA@AEBVQString@@PEAVQObject@@@Z) referenced in function "public: __cdecl MainWindow::MainWindow(class QWidget *)" (??0MainWindow@@QEAA@PEAVQWidget@@@Z)
    mainwindow.obj:-1: error: LNK2019: unresolved external symbol "public: virtual __cdecl TreeModel::~TreeModel(void)" (??1TreeModel@@UEAA@XZ) referenced in function "public: __cdecl MainWindow::MainWindow(class QWidget *)" (??0MainWindow@@QEAA@PEAVQWidget@@@Z)
    debug\Tree_Gui.exe:-1: error: LNK1120: 2 unresolved externals

    I don’t know where the error is. I have included the corresponding files.
    Someone can help me?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Can you post your code please ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • T Offline
        T Offline
        tujiaw
        wrote on last edited by
        #3

        first you need execute qmake

        C 1 Reply Last reply
        3
        • T tujiaw

          first you need execute qmake

          C Offline
          C Offline
          ChusMatesanz
          wrote on last edited by
          #4

          @tujiaw Thank you very much for your help. That seems to work.

          However, I would like to know the reason why I have to run qmake before building.

          J.HilkJ 1 Reply Last reply
          0
          • C ChusMatesanz

            @tujiaw Thank you very much for your help. That seems to work.

            However, I would like to know the reason why I have to run qmake before building.

            J.HilkJ Offline
            J.HilkJ Offline
            J.Hilk
            Moderators
            wrote on last edited by
            #5

            @ChusMatesanz qmake uses the information within the *.pro file to generate Makefiles that contain all the commands that are needed to build each project.
            When you build a project and no makefiles are found, they are created, but if some are found, it skips this part. It even tells you so in the compiler out put ..skipping qmake step . So changes, like linking files, are not neccessarly taken care of.


            Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


            Q: What's that?
            A: It's blue light.
            Q: What does it do?
            A: It turns blue.

            1 Reply Last reply
            3

            • Login

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