Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Undefined reference - again - discussion
QtWS25 Last Chance

Undefined reference - again - discussion

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
18 Posts 4 Posters 1.4k 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.
  • A Offline
    A Offline
    Anonymous_Banned275
    wrote on last edited by Anonymous_Banned275
    #1

    MORE ADDENDUM

    Is this red / green line thru #67 - #74 an error indicator ?

    For sake of discussion - I will make an exception and ask for reference to Qt document (RTFM)....

    feaa156d-f0dd-4953-a730-4a9d576d1a9b-image.png

    ADDENDUM

    Is this just a confirmation of the issue and not really more help info ?

    There is only ONE MainWindow in the project and it really does not point to source of the problem, but to the "result" object file.

    Am I correct ?

    I have deleted all optional sources from the .pro file, same issue.

    make[1]: Leaving directory '/mnt/A_BT_DEC10/BT__PROGRAMS/A_MAR7_MAR15/A_BT_LIBRARY/terminal_Bluetooth'
    /usr/bin/ld: /usr/bin/ld: DWARF error: invalid or unhandled FORM value: 0x23
    mainwindow.o: in function MainWindow::MainWindow()': mainwindow.cpp:(.text+0x1c8): undefined reference to terminal_ORIGINAL_MainWindow::terminal_ORIGINAL_MainWindow(QWidget*)'
    /usr/bin/ld: mainwindow.cpp:(.text+0x1e7): undefined reference to `terminal_ORIGINAL_MainWindow::terminal_ORIGINAL_MainWindow(QWidget*)'
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make[1]: Leaving directory '/mnt/A_BT_DEC10/BT__PROGRAMS/A_MAR7_MAR15/A_BT_LIBRARY/mdi'
    make[1]: *** [Makefile:293: mdi] Error 1
    make: *** [Makefile:595: sub----A_BT_LIBRARY-mdi-make_first] Error 2
    10:13:15: The process "/usr/bin/make" exited with code 2.
    Error while building/deploying project A_Mar7_MAR17 (kit: Qt 5.15.2 (gcc_64))
    When executing step "Make"

    Undefined reference - again - discussion
    help me to improve debugging process.

    I am posting this to get some MORE ideas how to find the code problem.

    Currently I have the class in question added to my "parent class" header :

    public:
    terminal_ORIGINAL_MainWindow *pTOMW;:

    there is no indication of error there

    I have added this code to my parent constructor :

    terminal_ORIGINAL_MainWindow *p = new terminal_ORIGINAL_MainWindow();
    p->show();
    
    pTOMW = new terminal_ORIGINAL_MainWindow();
    pTOMW->show();
    

    There is no indication of error there.

    The class in question runs just as expected when
    I change the TEMPLATE in .pro to app, BUT fails when the TEMPLATE is set to library.

    The compiler builds the library and the there ARE NO missing headers.

    The intelisense has NO ISSUES suggesting the code options when editing - hence there is a valid reference for intelisense to work as expected.

    Yes, the correct library was added to parent class.
    Yes, I have similary modified class / project added to my subprojects and it works as expected.

    Hence i HAVE , OBVIOUSLY, missed something when duplicating SAME Qt example. ( No need to confirm that...)

    In an essence - the code works as an independent project, but fails to work when added to subdir project.

    I am asking for help trying some other ways to identify the missing code.

    I was ho[ping I try to find some way to compare the working code with the failing one, perhaps file by file...

    I am NOT asking for RTFM or actual code , I am asking for help to improve debugging process.

    4aa197b5-17b7-428b-ad71-4ef753a508d8-image.png

    /mnt/A_BT_DEC10/BT__PROGRAMS/A_MAR7_MAR15/A_BT_LIBRARY/mdi/mainwindow.cpp:-1: error: undefined reference to `terminal_ORIGINAL_MainWindow::terminal_ORIGINAL_MainWindow(QWidget*)'

    PS
    Need more info ? ASK

    JonBJ J.HilkJ 2 Replies Last reply
    0
    • A Anonymous_Banned275

      MORE ADDENDUM

      Is this red / green line thru #67 - #74 an error indicator ?

      For sake of discussion - I will make an exception and ask for reference to Qt document (RTFM)....

      feaa156d-f0dd-4953-a730-4a9d576d1a9b-image.png

      ADDENDUM

      Is this just a confirmation of the issue and not really more help info ?

      There is only ONE MainWindow in the project and it really does not point to source of the problem, but to the "result" object file.

      Am I correct ?

      I have deleted all optional sources from the .pro file, same issue.

      make[1]: Leaving directory '/mnt/A_BT_DEC10/BT__PROGRAMS/A_MAR7_MAR15/A_BT_LIBRARY/terminal_Bluetooth'
      /usr/bin/ld: /usr/bin/ld: DWARF error: invalid or unhandled FORM value: 0x23
      mainwindow.o: in function MainWindow::MainWindow()': mainwindow.cpp:(.text+0x1c8): undefined reference to terminal_ORIGINAL_MainWindow::terminal_ORIGINAL_MainWindow(QWidget*)'
      /usr/bin/ld: mainwindow.cpp:(.text+0x1e7): undefined reference to `terminal_ORIGINAL_MainWindow::terminal_ORIGINAL_MainWindow(QWidget*)'
      clang: error: linker command failed with exit code 1 (use -v to see invocation)
      make[1]: Leaving directory '/mnt/A_BT_DEC10/BT__PROGRAMS/A_MAR7_MAR15/A_BT_LIBRARY/mdi'
      make[1]: *** [Makefile:293: mdi] Error 1
      make: *** [Makefile:595: sub----A_BT_LIBRARY-mdi-make_first] Error 2
      10:13:15: The process "/usr/bin/make" exited with code 2.
      Error while building/deploying project A_Mar7_MAR17 (kit: Qt 5.15.2 (gcc_64))
      When executing step "Make"

      Undefined reference - again - discussion
      help me to improve debugging process.

      I am posting this to get some MORE ideas how to find the code problem.

      Currently I have the class in question added to my "parent class" header :

      public:
      terminal_ORIGINAL_MainWindow *pTOMW;:

      there is no indication of error there

      I have added this code to my parent constructor :

      terminal_ORIGINAL_MainWindow *p = new terminal_ORIGINAL_MainWindow();
      p->show();
      
      pTOMW = new terminal_ORIGINAL_MainWindow();
      pTOMW->show();
      

      There is no indication of error there.

      The class in question runs just as expected when
      I change the TEMPLATE in .pro to app, BUT fails when the TEMPLATE is set to library.

      The compiler builds the library and the there ARE NO missing headers.

      The intelisense has NO ISSUES suggesting the code options when editing - hence there is a valid reference for intelisense to work as expected.

      Yes, the correct library was added to parent class.
      Yes, I have similary modified class / project added to my subprojects and it works as expected.

      Hence i HAVE , OBVIOUSLY, missed something when duplicating SAME Qt example. ( No need to confirm that...)

      In an essence - the code works as an independent project, but fails to work when added to subdir project.

      I am asking for help trying some other ways to identify the missing code.

      I was ho[ping I try to find some way to compare the working code with the failing one, perhaps file by file...

      I am NOT asking for RTFM or actual code , I am asking for help to improve debugging process.

      4aa197b5-17b7-428b-ad71-4ef753a508d8-image.png

      /mnt/A_BT_DEC10/BT__PROGRAMS/A_MAR7_MAR15/A_BT_LIBRARY/mdi/mainwindow.cpp:-1: error: undefined reference to `terminal_ORIGINAL_MainWindow::terminal_ORIGINAL_MainWindow(QWidget*)'

      PS
      Need more info ? ASK

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

      @AnneRanch
      It is a linker error. You just tell that by looking at the error message, e.g.

      /usr/bin/ld: mainwindow.cpp:(.text+0x1e7): undefined reference to `terminal_ORIGINAL_MainWindow::terminal_ORIGINAL_MainWindow(QWidget*)'

      ld is linker. Compilations/headers/includes are not relevant.

      You have some .cpp file which defines the class terminal_ORIGINAL_MainWindow. That gets compiled to a .o, perhaps terminal_ORIGINAL_MainWindow.o.

      Linking with mainwindow.o needs this because somewhere in mainwindow.cpp you create a terminal_ORIGINAL_MainWindow instance.

      • When the link is unsuccessful, you are linking with mainwindow.o but missing terminal_ORIGINAL_MainWindow.o, so it fails.

      • When the link is successful, either you are not linking with mainwindow.o or you are and you link with terminal_ORIGINAL_MainWindow.o too, so it succeeds.

      Perhaps what you link with differs between your "app" and "library" templates?

      A 1 Reply Last reply
      1
      • JonBJ JonB

        @AnneRanch
        It is a linker error. You just tell that by looking at the error message, e.g.

        /usr/bin/ld: mainwindow.cpp:(.text+0x1e7): undefined reference to `terminal_ORIGINAL_MainWindow::terminal_ORIGINAL_MainWindow(QWidget*)'

        ld is linker. Compilations/headers/includes are not relevant.

        You have some .cpp file which defines the class terminal_ORIGINAL_MainWindow. That gets compiled to a .o, perhaps terminal_ORIGINAL_MainWindow.o.

        Linking with mainwindow.o needs this because somewhere in mainwindow.cpp you create a terminal_ORIGINAL_MainWindow instance.

        • When the link is unsuccessful, you are linking with mainwindow.o but missing terminal_ORIGINAL_MainWindow.o, so it fails.

        • When the link is successful, either you are not linking with mainwindow.o or you are and you link with terminal_ORIGINAL_MainWindow.o too, so it succeeds.

        Perhaps what you link with differs between your "app" and "library" templates?

        A Offline
        A Offline
        Anonymous_Banned275
        wrote on last edited by
        #3

        @JonB OK, if it is linker error
        than I won't see any reference to source , correct?

        If that is true, now for next question

        what am I looking for as far as linker problem ?

        I generally do not write specific linker options - for obvious reason - the default linker options generally work...
        ( If it is not broke why fixing it ...)

        I just went thru building test subproject ( library) and have no issues , complier or linker.

        From that point of view -just my liker options are fine...
        My subproject contains several libraries with NO LINKER ISSUES.

        Perhaps linking / adding the problem library is the issue.
        ( you eluded to that )
        Than I need to go back to .pro and REMOVE the suspect library. That may give SAME error , or maybe "missing library " error ?

        Anyway, that is exactly the help I was asking for and I do appreciate that,

        A 1 Reply Last reply
        0
        • A Anonymous_Banned275

          @JonB OK, if it is linker error
          than I won't see any reference to source , correct?

          If that is true, now for next question

          what am I looking for as far as linker problem ?

          I generally do not write specific linker options - for obvious reason - the default linker options generally work...
          ( If it is not broke why fixing it ...)

          I just went thru building test subproject ( library) and have no issues , complier or linker.

          From that point of view -just my liker options are fine...
          My subproject contains several libraries with NO LINKER ISSUES.

          Perhaps linking / adding the problem library is the issue.
          ( you eluded to that )
          Than I need to go back to .pro and REMOVE the suspect library. That may give SAME error , or maybe "missing library " error ?

          Anyway, that is exactly the help I was asking for and I do appreciate that,

          A Offline
          A Offline
          Anonymous_Banned275
          wrote on last edited by
          #4

          @AnneRanch progress (?) report
          I have removed the offending project for .pro SOURCE
          Result is NO error at all - expected BUT
          I had to run "clear and rebuild " to get there. Odd.

          Commenting out the test project library resulted in "undefined reference " to it - somewhat expected.
          BUT
          I cannot duplicate SAME error by rerunning "clear and rebuild " - the error is gone...
          and BUT
          there were no "linker / object file errors as with the troublesome project.

          My conclusion , so far , to have consistent (error) results

          • it is better to "clear and rebuild" SEVERAL TIMES ...
          1 Reply Last reply
          0
          • S Offline
            S Offline
            SimonSchroeder
            wrote on last edited by
            #5

            @AnneRanch said in Undefined reference - again - discussion:

            Is this red / green line thru #67 - #74 an error indicator ?

            The red line is unsaved changes and the green line is saved changes. This helps you to find the parts in the file that you have changes since opening it.

            @AnneRanch said in Undefined reference - again - discussion:

            what am I looking for as far as linker problem ?
            I generally do not write specific linker options

            In the context of Qt everything would just be handled through the project file. If you add a .cpp file to the project the corresponding .o file should automatically be added to the linker flags.

            @AnneRanch said in Undefined reference - again - discussion:

            I had to run "clear and rebuild " to get there.

            I used the word "should" above. No build system is perfect and occasionally you need to clear everything and do a rebuild. In extreme cases, with qmake you need to "clear", then explicitly "run qmake", and only then rebuild your project.

            1 Reply Last reply
            1
            • A Anonymous_Banned275

              MORE ADDENDUM

              Is this red / green line thru #67 - #74 an error indicator ?

              For sake of discussion - I will make an exception and ask for reference to Qt document (RTFM)....

              feaa156d-f0dd-4953-a730-4a9d576d1a9b-image.png

              ADDENDUM

              Is this just a confirmation of the issue and not really more help info ?

              There is only ONE MainWindow in the project and it really does not point to source of the problem, but to the "result" object file.

              Am I correct ?

              I have deleted all optional sources from the .pro file, same issue.

              make[1]: Leaving directory '/mnt/A_BT_DEC10/BT__PROGRAMS/A_MAR7_MAR15/A_BT_LIBRARY/terminal_Bluetooth'
              /usr/bin/ld: /usr/bin/ld: DWARF error: invalid or unhandled FORM value: 0x23
              mainwindow.o: in function MainWindow::MainWindow()': mainwindow.cpp:(.text+0x1c8): undefined reference to terminal_ORIGINAL_MainWindow::terminal_ORIGINAL_MainWindow(QWidget*)'
              /usr/bin/ld: mainwindow.cpp:(.text+0x1e7): undefined reference to `terminal_ORIGINAL_MainWindow::terminal_ORIGINAL_MainWindow(QWidget*)'
              clang: error: linker command failed with exit code 1 (use -v to see invocation)
              make[1]: Leaving directory '/mnt/A_BT_DEC10/BT__PROGRAMS/A_MAR7_MAR15/A_BT_LIBRARY/mdi'
              make[1]: *** [Makefile:293: mdi] Error 1
              make: *** [Makefile:595: sub----A_BT_LIBRARY-mdi-make_first] Error 2
              10:13:15: The process "/usr/bin/make" exited with code 2.
              Error while building/deploying project A_Mar7_MAR17 (kit: Qt 5.15.2 (gcc_64))
              When executing step "Make"

              Undefined reference - again - discussion
              help me to improve debugging process.

              I am posting this to get some MORE ideas how to find the code problem.

              Currently I have the class in question added to my "parent class" header :

              public:
              terminal_ORIGINAL_MainWindow *pTOMW;:

              there is no indication of error there

              I have added this code to my parent constructor :

              terminal_ORIGINAL_MainWindow *p = new terminal_ORIGINAL_MainWindow();
              p->show();
              
              pTOMW = new terminal_ORIGINAL_MainWindow();
              pTOMW->show();
              

              There is no indication of error there.

              The class in question runs just as expected when
              I change the TEMPLATE in .pro to app, BUT fails when the TEMPLATE is set to library.

              The compiler builds the library and the there ARE NO missing headers.

              The intelisense has NO ISSUES suggesting the code options when editing - hence there is a valid reference for intelisense to work as expected.

              Yes, the correct library was added to parent class.
              Yes, I have similary modified class / project added to my subprojects and it works as expected.

              Hence i HAVE , OBVIOUSLY, missed something when duplicating SAME Qt example. ( No need to confirm that...)

              In an essence - the code works as an independent project, but fails to work when added to subdir project.

              I am asking for help trying some other ways to identify the missing code.

              I was ho[ping I try to find some way to compare the working code with the failing one, perhaps file by file...

              I am NOT asking for RTFM or actual code , I am asking for help to improve debugging process.

              4aa197b5-17b7-428b-ad71-4ef753a508d8-image.png

              /mnt/A_BT_DEC10/BT__PROGRAMS/A_MAR7_MAR15/A_BT_LIBRARY/mdi/mainwindow.cpp:-1: error: undefined reference to `terminal_ORIGINAL_MainWindow::terminal_ORIGINAL_MainWindow(QWidget*)'

              PS
              Need more info ? ASK

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

              @AnneRanch said in Undefined reference - again - discussion:

              I change the TEMPLATE in .pro to app, BUT fails when the TEMPLATE is set to library.

              this might be the crux of the problem, did you do that previously to the error appearing as well ?

              The build system usually doesn't rebuild object files on its own, if there are no changes in the source files. But changing from standalone app to library does require different object files.

              this is for example one of the reasons, why shadow build folders in QtCreator have the QtVersion/Compiler in its name. To not mix obj files created.


              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.

              A 1 Reply Last reply
              1
              • J.HilkJ J.Hilk

                @AnneRanch said in Undefined reference - again - discussion:

                I change the TEMPLATE in .pro to app, BUT fails when the TEMPLATE is set to library.

                this might be the crux of the problem, did you do that previously to the error appearing as well ?

                The build system usually doesn't rebuild object files on its own, if there are no changes in the source files. But changing from standalone app to library does require different object files.

                this is for example one of the reasons, why shadow build folders in QtCreator have the QtVersion/Compiler in its name. To not mix obj files created.

                A Offline
                A Offline
                Anonymous_Banned275
                wrote on last edited by
                #7

                @J-Hilk I am using changing the TEMPLATE as debugging tool.
                In my case just to make sure the code works / runs independent of library usage.
                I actually have two copies of the "problem
                " source code - one in subdirs project and one as an independent project.

                Mainly because when I change the template to app , I cannot "run" the problem code , the main subdirs project does not like "two" main apps.

                BTW

                I think the problem is in "mixing " include and actual link to the .so code - I am going to verify all of the next.

                A 1 Reply Last reply
                0
                • A Anonymous_Banned275

                  @J-Hilk I am using changing the TEMPLATE as debugging tool.
                  In my case just to make sure the code works / runs independent of library usage.
                  I actually have two copies of the "problem
                  " source code - one in subdirs project and one as an independent project.

                  Mainly because when I change the template to app , I cannot "run" the problem code , the main subdirs project does not like "two" main apps.

                  BTW

                  I think the problem is in "mixing " include and actual link to the .so code - I am going to verify all of the next.

                  A Offline
                  A Offline
                  Anonymous_Banned275
                  wrote on last edited by
                  #8

                  @AnneRanch OK, here is complier / linker output AFTER the TEMPLATE = lib

                  09:31:01: Running steps for project terminal...
                  09:31:01: Starting: "/home/nov25-1/Qt/5.15.2/gcc_64/bin/qmake" /mnt/A_BT_DEC10/BT__PROGRAMS/A_MAR7_MAR15/A_BT_LIBRARY/CCC_SOURCE/TERMINAL_example_source/terminal/terminal.pro -spec linux-clang CONFIG+=debug CONFIG+=qml_debug
                  Project MESSAGE: RESTOREd ALL resouces - DEBUG commneted out options resouces - same issue
                  Project MESSAGE: Changed back to TEMPLATE = lib
                  /mnt/A_BT_DEC10/BT__PROGRAMS/A_MAR7_MAR15/A_BT_LIBRARY/CCC_SOURCE/TERMINAL_example_source/terminal/terminal.pro:36: message(message) requires one argument.
                  Project MESSAGE:
                  09:31:01: The process "/home/nov25-1/Qt/5.15.2/gcc_64/bin/qmake" exited normally.

                  09:31:01: Starting: "/usr/bin/make" -f /mnt/A_BT_DEC10/BT__PROGRAMS/A_MAR7_MAR15/A_BT_LIBRARY/CCC_SOURCE/TERMINAL_example_source/terminal/Makefile qmake_all
                  make: Nothing to be done for 'qmake_all'.
                  09:31:01: The process "/usr/bin/make" exited normally.

                  09:31:01: Starting: "/usr/bin/make" -j4
                  rm -f libterminal.so.1.0.0 libterminal.so libterminal.so.1 libterminal.so.1.0
                  clang++ -ccc-gcc-name g++ -Wl,-rpath,/home/nov25-1/Qt/5.15.2/gcc_64/lib -shared -Wl,-soname,libterminal.so.1 -o libterminal.so.1.0.0 main.o settingsdialog.o console.o terminal_ORIGINAL_mainwindow.o qrc_terminal.o moc_settingsdialog.o moc_console.o moc_terminal_ORIGINAL_mainwindow.o /home/nov25-1/Qt/5.15.2/gcc_64/lib/libQt5Widgets.so

                  /home/nov25-1/Qt/5.15.2/gcc_64/lib/libQt5Gui.so /home/nov25-1/Qt/5.15.2/gcc_64/lib/libQt5SerialPort.so /home/nov25-1/Qt/5.15.2/gcc_64/lib/libQt5Core.so -lGL -lpthread
                  ln -s libterminal.so.1.0.0 libterminal.so
                  ln -s libterminal.so.1.0.0 libterminal.so.1
                  ln -s libterminal.so.1.0.0 libterminal.so.1.0
                  09:31:03: The process "/usr/bin/make" exited normally.
                  09:31:03: Elapsed time: 00:02.

                  1.Does THIS output help me to ADD correct #include header to the "parent " class ?

                  2.Does THIS output help me to ADD correct "library" to the "parent " class ?

                  Using "Add library" option - internal or external or ...

                  A 1 Reply Last reply
                  0
                  • A Anonymous_Banned275

                    @AnneRanch OK, here is complier / linker output AFTER the TEMPLATE = lib

                    09:31:01: Running steps for project terminal...
                    09:31:01: Starting: "/home/nov25-1/Qt/5.15.2/gcc_64/bin/qmake" /mnt/A_BT_DEC10/BT__PROGRAMS/A_MAR7_MAR15/A_BT_LIBRARY/CCC_SOURCE/TERMINAL_example_source/terminal/terminal.pro -spec linux-clang CONFIG+=debug CONFIG+=qml_debug
                    Project MESSAGE: RESTOREd ALL resouces - DEBUG commneted out options resouces - same issue
                    Project MESSAGE: Changed back to TEMPLATE = lib
                    /mnt/A_BT_DEC10/BT__PROGRAMS/A_MAR7_MAR15/A_BT_LIBRARY/CCC_SOURCE/TERMINAL_example_source/terminal/terminal.pro:36: message(message) requires one argument.
                    Project MESSAGE:
                    09:31:01: The process "/home/nov25-1/Qt/5.15.2/gcc_64/bin/qmake" exited normally.

                    09:31:01: Starting: "/usr/bin/make" -f /mnt/A_BT_DEC10/BT__PROGRAMS/A_MAR7_MAR15/A_BT_LIBRARY/CCC_SOURCE/TERMINAL_example_source/terminal/Makefile qmake_all
                    make: Nothing to be done for 'qmake_all'.
                    09:31:01: The process "/usr/bin/make" exited normally.

                    09:31:01: Starting: "/usr/bin/make" -j4
                    rm -f libterminal.so.1.0.0 libterminal.so libterminal.so.1 libterminal.so.1.0
                    clang++ -ccc-gcc-name g++ -Wl,-rpath,/home/nov25-1/Qt/5.15.2/gcc_64/lib -shared -Wl,-soname,libterminal.so.1 -o libterminal.so.1.0.0 main.o settingsdialog.o console.o terminal_ORIGINAL_mainwindow.o qrc_terminal.o moc_settingsdialog.o moc_console.o moc_terminal_ORIGINAL_mainwindow.o /home/nov25-1/Qt/5.15.2/gcc_64/lib/libQt5Widgets.so

                    /home/nov25-1/Qt/5.15.2/gcc_64/lib/libQt5Gui.so /home/nov25-1/Qt/5.15.2/gcc_64/lib/libQt5SerialPort.so /home/nov25-1/Qt/5.15.2/gcc_64/lib/libQt5Core.so -lGL -lpthread
                    ln -s libterminal.so.1.0.0 libterminal.so
                    ln -s libterminal.so.1.0.0 libterminal.so.1
                    ln -s libterminal.so.1.0.0 libterminal.so.1.0
                    09:31:03: The process "/usr/bin/make" exited normally.
                    09:31:03: Elapsed time: 00:02.

                    1.Does THIS output help me to ADD correct #include header to the "parent " class ?

                    2.Does THIS output help me to ADD correct "library" to the "parent " class ?

                    Using "Add library" option - internal or external or ...

                    A Offline
                    A Offline
                    Anonymous_Banned275
                    wrote on last edited by
                    #9

                    @AnneRanch

                    After
                    changing the #include to

                    #include < header file >

                    adding library using "external " with full path

                    I still get same , agree this is a linker, error pointing to here:

                        // TEST_SUBPROJECT
                        text = " TEMPORARY WINDOW TITLE CHANGED index 40 ...";
                        TEST_PROJECT_MainWindow *pTEST_INDEX = new TEST_PROJECT_MainWindow();
                        pTEST_INDEX->setWindowTitle(text);
                        add_mdi_subwindow (pTEST_INDEX);
                    
                        // debug terminal issue
                    
                     This code fails but there is no compiler error indicated
                    
                    
                        **terminal_ORIGINAL_MainWindow *pTERMINAL = new terminal_ORIGINAL_MainWindow();
                        add_mdi_subwindow (pTERMINAL);**
                    
                     This code fails but there is no compiler indicated
                    
                    JonBJ 1 Reply Last reply
                    0
                    • A Anonymous_Banned275

                      @AnneRanch

                      After
                      changing the #include to

                      #include < header file >

                      adding library using "external " with full path

                      I still get same , agree this is a linker, error pointing to here:

                          // TEST_SUBPROJECT
                          text = " TEMPORARY WINDOW TITLE CHANGED index 40 ...";
                          TEST_PROJECT_MainWindow *pTEST_INDEX = new TEST_PROJECT_MainWindow();
                          pTEST_INDEX->setWindowTitle(text);
                          add_mdi_subwindow (pTEST_INDEX);
                      
                          // debug terminal issue
                      
                       This code fails but there is no compiler error indicated
                      
                      
                          **terminal_ORIGINAL_MainWindow *pTERMINAL = new terminal_ORIGINAL_MainWindow();
                          add_mdi_subwindow (pTERMINAL);**
                      
                       This code fails but there is no compiler indicated
                      
                      JonBJ Offline
                      JonBJ Offline
                      JonB
                      wrote on last edited by JonB
                      #10

                      @AnneRanch said in Undefined reference - again - discussion:

                      This code fails but there is no compiler error indicated

                      That is because it is a linker error. You told the compiler that there is a terminal_ORIGINAL_MainWindow class in another file, but you did not link with terminal_ORIGINAL_MainWindow.o , which you need to do as it has the class code, so the linker could not succeed.

                      If you had not #included the terminal_ORIGINAL_MainWindow.h file THAT would have given a compilation error on the new terminal_ORIGINAL_MainWindow() line. But including that allows it to compile, and says the terminal_ORIGINAL_MainWindow.o object file will be provided at link time. But, for whatever reason, it is not when you get your error.

                      That is what the Undefined reference error message from linker (ld) indicates each time.

                      A 2 Replies Last reply
                      0
                      • JonBJ JonB

                        @AnneRanch said in Undefined reference - again - discussion:

                        This code fails but there is no compiler error indicated

                        That is because it is a linker error. You told the compiler that there is a terminal_ORIGINAL_MainWindow class in another file, but you did not link with terminal_ORIGINAL_MainWindow.o , which you need to do as it has the class code, so the linker could not succeed.

                        If you had not #included the terminal_ORIGINAL_MainWindow.h file THAT would have given a compilation error on the new terminal_ORIGINAL_MainWindow() line. But including that allows it to compile, and says the terminal_ORIGINAL_MainWindow.o object file will be provided at link time. But, for whatever reason, it is not when you get your error.

                        That is what the Undefined reference error message from linker (ld) indicates each time.

                        A Offline
                        A Offline
                        Anonymous_Banned275
                        wrote on last edited by
                        #11
                        This post is deleted!
                        1 Reply Last reply
                        0
                        • A Offline
                          A Offline
                          Anonymous_Banned275
                          wrote on last edited by Anonymous_Banned275
                          #12

                          UPDATE

                          I have given up trying to physically find the "linker" problem.
                          I am trying a DIFFERENT way to resolve this AND could use some help.

                          I now have TWO "subdirs" projects - my main one , the one which refuses to work , and working "helper project".

                          The "helper project" works as expected - here is the result:

                          41b23c80-a94c-42ef-8716-3a4b2602ab9b-image.png

                          ![2c014c03-91ca-4ba5-ae24-cf8f36e7d9c3-image.png](https://ddgobkiprc33d.cloudfront.net/e8891de0-f237-4934-894d-ed0fc54abae2.png

                          As "subdirs" , the "helper project" has main .pro and terminal .pro.

                          I repeat - the "terminal" helper project works BY ITSELF as expected.

                          I have successfully added the "helper project " to my main project. - "TEST_MAIN_SUBPROJECT "

                          Here is the picture of ALL .pro files in it:

                          f34e3ce7-7b94-40a5-b026-07f4a6c6004a-image.png

                          HERE IS WHAT I NEED HELP WITH
                          Currently the TEST_MAIN_SUBPROJECT runs
                          TERMINAL_SUBDIRS_PROJECT "MAIN_PROJECT" - as posted at the start of this post.

                          I need to SWITCH it to run

                          A_Mar7_MAR17.pro

                          the original , faulty project , which refuses to link with "terminal".

                          ca6a2994-e8c5-4934-b5a7-21e0adafc493-image.png

                          I am hoping that I can then use the working

                          TERMINAL_SUBDIRS_PROJECT and its working "terminal".

                          My main, so far faulty , project MaiN WINDOW IS "mdi.pro".
                          I would prefer to use "mdi.pro"
                          , but if it will work I could run the

                          TERMINAL_SUBDIRS_PROJECT "MAIN_PROJECT"(,pro) main window" with
                          A_Mar7_MAR17.pro as child.

                          I do realize this approach is convoluted, but my main goal is is to link "TEST_MAIN_SUBPROJECT " with "terminal" irregardless how many parent - child levels it takes.

                          THANKS

                          A 1 Reply Last reply
                          0
                          • A Anonymous_Banned275

                            UPDATE

                            I have given up trying to physically find the "linker" problem.
                            I am trying a DIFFERENT way to resolve this AND could use some help.

                            I now have TWO "subdirs" projects - my main one , the one which refuses to work , and working "helper project".

                            The "helper project" works as expected - here is the result:

                            41b23c80-a94c-42ef-8716-3a4b2602ab9b-image.png

                            ![2c014c03-91ca-4ba5-ae24-cf8f36e7d9c3-image.png](https://ddgobkiprc33d.cloudfront.net/e8891de0-f237-4934-894d-ed0fc54abae2.png

                            As "subdirs" , the "helper project" has main .pro and terminal .pro.

                            I repeat - the "terminal" helper project works BY ITSELF as expected.

                            I have successfully added the "helper project " to my main project. - "TEST_MAIN_SUBPROJECT "

                            Here is the picture of ALL .pro files in it:

                            f34e3ce7-7b94-40a5-b026-07f4a6c6004a-image.png

                            HERE IS WHAT I NEED HELP WITH
                            Currently the TEST_MAIN_SUBPROJECT runs
                            TERMINAL_SUBDIRS_PROJECT "MAIN_PROJECT" - as posted at the start of this post.

                            I need to SWITCH it to run

                            A_Mar7_MAR17.pro

                            the original , faulty project , which refuses to link with "terminal".

                            ca6a2994-e8c5-4934-b5a7-21e0adafc493-image.png

                            I am hoping that I can then use the working

                            TERMINAL_SUBDIRS_PROJECT and its working "terminal".

                            My main, so far faulty , project MaiN WINDOW IS "mdi.pro".
                            I would prefer to use "mdi.pro"
                            , but if it will work I could run the

                            TERMINAL_SUBDIRS_PROJECT "MAIN_PROJECT"(,pro) main window" with
                            A_Mar7_MAR17.pro as child.

                            I do realize this approach is convoluted, but my main goal is is to link "TEST_MAIN_SUBPROJECT " with "terminal" irregardless how many parent - child levels it takes.

                            THANKS

                            A Offline
                            A Offline
                            Anonymous_Banned275
                            wrote on last edited by
                            #13

                            @AnneRanch UPDATE

                            Question
                            what configures the Qt to run TEST_MAIN_SUBPROJECTpro ?

                            09:12:11: Running steps for project TEST_MAIN_SUBPROJECT...
                            09:12:11: Starting: "/home/nov25-1/Qt/5.15.2/gcc_64/bin/qmake" /mnt/A_BT_DEC10/BT__PROGRAMS/A_APR/A_APR6_MAR7_MAR19_CLEAN/A_BT_LIBRARY/CCC_SOURCE/TEST_MAIN_SUBPROJECT_PROJECT/TEST_MAIN_SUBPROJECT/TEST_MAIN_SUBPROJECT.pro -spec linux-clang CONFIG+=debug CONFIG+=qml_debug CONFIG+=force_debug_info CONFIG+=separate_debug_info
                            Project MESSAGE:
                            Project MESSAGE: run TEST_MAIN_SUBPROJECT.pro
                            Project MESSAGE:

                            it is LAST .pro in the project

                            10fddb64-c7e9-4c6c-9b4c-8f4ba1651412-image.png

                            J.HilkJ 1 Reply Last reply
                            0
                            • A Anonymous_Banned275

                              @AnneRanch UPDATE

                              Question
                              what configures the Qt to run TEST_MAIN_SUBPROJECTpro ?

                              09:12:11: Running steps for project TEST_MAIN_SUBPROJECT...
                              09:12:11: Starting: "/home/nov25-1/Qt/5.15.2/gcc_64/bin/qmake" /mnt/A_BT_DEC10/BT__PROGRAMS/A_APR/A_APR6_MAR7_MAR19_CLEAN/A_BT_LIBRARY/CCC_SOURCE/TEST_MAIN_SUBPROJECT_PROJECT/TEST_MAIN_SUBPROJECT/TEST_MAIN_SUBPROJECT.pro -spec linux-clang CONFIG+=debug CONFIG+=qml_debug CONFIG+=force_debug_info CONFIG+=separate_debug_info
                              Project MESSAGE:
                              Project MESSAGE: run TEST_MAIN_SUBPROJECT.pro
                              Project MESSAGE:

                              it is LAST .pro in the project

                              10fddb64-c7e9-4c6c-9b4c-8f4ba1651412-image.png

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

                              @AnneRanch said in Undefined reference - again - discussion:

                              what configures the Qt to run TEST_MAIN_SUBPROJECTpro ?

                              when your project creates multiple executables that could potentially be executed. You can specify inside the project tab under "run settings" which executable is supposed to be run.

                              afcc0a39-dd12-499b-bab1-cdca662becae-image.png


                              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.

                              A 1 Reply Last reply
                              1
                              • J.HilkJ J.Hilk

                                @AnneRanch said in Undefined reference - again - discussion:

                                what configures the Qt to run TEST_MAIN_SUBPROJECTpro ?

                                when your project creates multiple executables that could potentially be executed. You can specify inside the project tab under "run settings" which executable is supposed to be run.

                                afcc0a39-dd12-499b-bab1-cdca662becae-image.png

                                A Offline
                                A Offline
                                Anonymous_Banned275
                                wrote on last edited by
                                #15

                                @J-Hilk f95763d0-7eba-4935-ad41-79232048202a-image.png

                                OK , I got this , BUT
                                it looks as there is no "pull down " box...

                                Not sure I want to do this manually.

                                JonBJ 1 Reply Last reply
                                0
                                • A Anonymous_Banned275

                                  @J-Hilk f95763d0-7eba-4935-ad41-79232048202a-image.png

                                  OK , I got this , BUT
                                  it looks as there is no "pull down " box...

                                  Not sure I want to do this manually.

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

                                  @AnneRanch
                                  You are looking at Build Settings. @J-Hilk showed Run Settings

                                  You can specify inside the project tab under "run settings" which executable is supposed to be run.

                                  1 Reply Last reply
                                  1
                                  • A Offline
                                    A Offline
                                    Anonymous_Banned275
                                    wrote on last edited by Anonymous_Banned275
                                    #17

                                    @JonB Unfortunately 'run setting" does not let select .pro but sudirs project executable.
                                    That does not help to bypass the terminal problem.
                                    If I select modify and select "mdi" it actually runs the "mdi" BEFORE the modification.
                                    The editor shows errors , it should, and it should not run.

                                    1 Reply Last reply
                                    0
                                    • JonBJ JonB referenced this topic on
                                    • JonBJ JonB

                                      @AnneRanch said in Undefined reference - again - discussion:

                                      This code fails but there is no compiler error indicated

                                      That is because it is a linker error. You told the compiler that there is a terminal_ORIGINAL_MainWindow class in another file, but you did not link with terminal_ORIGINAL_MainWindow.o , which you need to do as it has the class code, so the linker could not succeed.

                                      If you had not #included the terminal_ORIGINAL_MainWindow.h file THAT would have given a compilation error on the new terminal_ORIGINAL_MainWindow() line. But including that allows it to compile, and says the terminal_ORIGINAL_MainWindow.o object file will be provided at link time. But, for whatever reason, it is not when you get your error.

                                      That is what the Undefined reference error message from linker (ld) indicates each time.

                                      A Offline
                                      A Offline
                                      Anonymous_Banned275
                                      wrote on last edited by
                                      #18

                                      @JonB OK, back to terminology...
                                      I use "Add library" to add it to the subproject / object who needs it...
                                      I let Qt to select "internal" library ....by project name - AKA "terminal"
                                      From there it is Qt who actually adds stuff - mostly to .pro file.

                                      I have to add required headers...
                                      editor and compiler passes the headers as valid

                                      Then I usually run "Clear" and "Rebuild".
                                      That is it...

                                      I do not see the references to library.o AND library.so until the complier / linker is done.

                                      The linker error is actually very last few lies of the "Rebuild" process.

                                      1 Reply Last reply
                                      0

                                      • Login

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