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. how to fix linker error in eclipse on linux

how to fix linker error in eclipse on linux

Scheduled Pinned Locked Moved Solved General and Desktop
58 Posts 3 Posters 22.9k 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.
  • jsulmJ jsulm

    @micha_eleric said in how to fix linker error in eclipse on linux:

    under Properties->C/C++ Build->Settings->Tool Settings->GCC C++ Linker->Libraries->Libraries (-l) /usr/include/qt4/QtGui

    /usr/include/qt4/QtGui contains header files, not libraries!
    You need to specify the folder where Qt libraries are located.
    Thoese should be somewhere in /usr/lib

    M Offline
    M Offline
    micha_eleric
    wrote on last edited by
    #3

    @jsulm well. /usr/lib/qt5 only contains dir bin, which contains fixqt4headers.pl, moc, qdbus, qdbuscpp2xml, qdbusxml2cpp, qlalr, qmake, qvkgen, rcc, syncqt.pl, uic

    if:
    under Properties->C/C++ Build->Settings->Tool Settings->GCC C++ Linker->Libraries->Libraries (-l) /usr/lib/qt5/bin
    error:
    /usr/bin/ld: cannot find -l/usr/lib/qt5/bin

    /usr/lib/ only has qt5 dir, that may look like it has anything to do with qt

    jsulmJ 1 Reply Last reply
    0
    • M micha_eleric

      @jsulm well. /usr/lib/qt5 only contains dir bin, which contains fixqt4headers.pl, moc, qdbus, qdbuscpp2xml, qdbusxml2cpp, qlalr, qmake, qvkgen, rcc, syncqt.pl, uic

      if:
      under Properties->C/C++ Build->Settings->Tool Settings->GCC C++ Linker->Libraries->Libraries (-l) /usr/lib/qt5/bin
      error:
      /usr/bin/ld: cannot find -l/usr/lib/qt5/bin

      /usr/lib/ only has qt5 dir, that may look like it has anything to do with qt

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #4

      @micha_eleric said in how to fix linker error in eclipse on linux:

      /usr/lib/qt5/bin

      You are setting include folder for Qt4, but here you're trying to add Qt5 lib folder!
      What Qt version do you actually want to use?
      What Qt version did you install and how?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      M 1 Reply Last reply
      0
      • jsulmJ jsulm

        @micha_eleric said in how to fix linker error in eclipse on linux:

        /usr/lib/qt5/bin

        You are setting include folder for Qt4, but here you're trying to add Qt5 lib folder!
        What Qt version do you actually want to use?
        What Qt version did you install and how?

        M Offline
        M Offline
        micha_eleric
        wrote on last edited by
        #5

        @jsulm i installed qt4, but qt5 was the only qt dir made in /usr/lib

        i am looking around in other dir for anything qt

        jsulmJ 1 Reply Last reply
        0
        • M micha_eleric

          @jsulm i installed qt4, but qt5 was the only qt dir made in /usr/lib

          i am looking around in other dir for anything qt

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #6

          @micha_eleric said in how to fix linker error in eclipse on linux:

          i installed qt4

          How?
          Search in /usr/lib, /usr/lib64 for files containing "qt4" in their names.

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          M 1 Reply Last reply
          0
          • jsulmJ jsulm

            @micha_eleric said in how to fix linker error in eclipse on linux:

            i installed qt4

            How?
            Search in /usr/lib, /usr/lib64 for files containing "qt4" in their names.

            M Offline
            M Offline
            micha_eleric
            wrote on last edited by
            #7

            @jsulm how i install qt4?
            i did internet search for "sudo install qt4". i just redid search, but only came up with install qt5, however the numbers dont look the same.

            under /usr/lib:
            python3.9
            qt5
            recovery-mode

            under usr/lib64:
            ld-linux-x86-64.so.2

            under /usr/include:
            python3.8
            qt4
            rdma

            jsulmJ 1 Reply Last reply
            0
            • M micha_eleric

              @jsulm how i install qt4?
              i did internet search for "sudo install qt4". i just redid search, but only came up with install qt5, however the numbers dont look the same.

              under /usr/lib:
              python3.9
              qt5
              recovery-mode

              under usr/lib64:
              ld-linux-x86-64.so.2

              under /usr/include:
              python3.8
              qt4
              rdma

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #8

              @micha_eleric said in how to fix linker error in eclipse on linux:

              under /usr/lib:
              python3.9
              qt5
              recovery-mode
              under usr/lib64:
              ld-linux-x86-64.so.2

              There should be way more than that.
              I suggested to search:

              find /usr/lib -name *qt4*
              find /usr/lib64 -name *qt4*
              

              What Linux distribution do you use? Please also tell the version.

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              M 2 Replies Last reply
              0
              • jsulmJ jsulm

                @micha_eleric said in how to fix linker error in eclipse on linux:

                under /usr/lib:
                python3.9
                qt5
                recovery-mode
                under usr/lib64:
                ld-linux-x86-64.so.2

                There should be way more than that.
                I suggested to search:

                find /usr/lib -name *qt4*
                find /usr/lib64 -name *qt4*
                

                What Linux distribution do you use? Please also tell the version.

                M Offline
                M Offline
                micha_eleric
                wrote on last edited by
                #9

                @jsulm there is a lot more, i only listed what was before and after qt

                looking back through command line, i wonder if i half installed

                1 Reply Last reply
                0
                • jsulmJ jsulm

                  @micha_eleric said in how to fix linker error in eclipse on linux:

                  under /usr/lib:
                  python3.9
                  qt5
                  recovery-mode
                  under usr/lib64:
                  ld-linux-x86-64.so.2

                  There should be way more than that.
                  I suggested to search:

                  find /usr/lib -name *qt4*
                  find /usr/lib64 -name *qt4*
                  

                  What Linux distribution do you use? Please also tell the version.

                  M Offline
                  M Offline
                  micha_eleric
                  wrote on last edited by
                  #10

                  @jsulm from https://ubuntuhandbook.org/index.php/2020/07/install-qt4-ubuntu-20-04/

                  i have:
                  sudo add-apt-repository ppa:rock-core/qt4
                  in command line.

                  ??anything else should be installed?

                  jsulmJ 1 Reply Last reply
                  0
                  • M micha_eleric

                    @jsulm from https://ubuntuhandbook.org/index.php/2020/07/install-qt4-ubuntu-20-04/

                    i have:
                    sudo add-apt-repository ppa:rock-core/qt4
                    in command line.

                    ??anything else should be installed?

                    jsulmJ Offline
                    jsulmJ Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on last edited by
                    #11

                    @micha_eleric said in how to fix linker error in eclipse on linux:

                    sudo add-apt-repository ppa:rock-core/qt4

                    This does not install anything!
                    This command only adds a new source for packages.
                    You need to install needed packages using "apt install PACKET_NAME".

                    One question: do you really need Qt4?

                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                    M 1 Reply Last reply
                    0
                    • jsulmJ jsulm

                      @micha_eleric said in how to fix linker error in eclipse on linux:

                      sudo add-apt-repository ppa:rock-core/qt4

                      This does not install anything!
                      This command only adds a new source for packages.
                      You need to install needed packages using "apt install PACKET_NAME".

                      One question: do you really need Qt4?

                      M Offline
                      M Offline
                      micha_eleric
                      wrote on last edited by micha_eleric
                      #12

                      @jsulm qt4 it is what i started with.

                      i also found:
                      sudo apt install qt4-dev-tools libqt4-dev libqt4-core libqt4-gui

                      which seems to be from:
                      https://askubuntu.com/questions/1274134/cannot-install-qt-4-on-ubuntu-20-04-quite-universal-circuit-simulator-qucs

                      this is last i found with qt*, if it is not installing qt4, then i guess my errors have been found

                      sudo apt-get install qt5-default
                      results:
                      qt5-default is already the newest version (5.12.8+dfsg-0ubuntu2.1).

                      however, there are no qt5 directory under /usr/include

                      JonBJ 1 Reply Last reply
                      0
                      • M micha_eleric

                        @jsulm qt4 it is what i started with.

                        i also found:
                        sudo apt install qt4-dev-tools libqt4-dev libqt4-core libqt4-gui

                        which seems to be from:
                        https://askubuntu.com/questions/1274134/cannot-install-qt-4-on-ubuntu-20-04-quite-universal-circuit-simulator-qucs

                        this is last i found with qt*, if it is not installing qt4, then i guess my errors have been found

                        sudo apt-get install qt5-default
                        results:
                        qt5-default is already the newest version (5.12.8+dfsg-0ubuntu2.1).

                        however, there are no qt5 directory under /usr/include

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

                        @micha_eleric said in how to fix linker error in eclipse on linux:

                        @jsulm qt4 it is what i started with.

                        This is not a great/clear answer, as @jsulm is pointing out that Qt4 is very old. Do you have a choice to move to Qt5, or even (hesitantly!) Qt6?

                        M 1 Reply Last reply
                        0
                        • JonBJ JonB

                          @micha_eleric said in how to fix linker error in eclipse on linux:

                          @jsulm qt4 it is what i started with.

                          This is not a great/clear answer, as @jsulm is pointing out that Qt4 is very old. Do you have a choice to move to Qt5, or even (hesitantly!) Qt6?

                          M Offline
                          M Offline
                          micha_eleric
                          wrote on last edited by
                          #14

                          @JonB it seems i already installed qt5. just it is not showing up under /usr/include

                          jsulmJ 1 Reply Last reply
                          0
                          • M micha_eleric

                            @JonB it seems i already installed qt5. just it is not showing up under /usr/include

                            jsulmJ Offline
                            jsulmJ Offline
                            jsulm
                            Lifetime Qt Champion
                            wrote on last edited by
                            #15

                            @micha_eleric said in how to fix linker error in eclipse on linux:

                            i already installed qt5

                            What exactly? Which qt5 packages?
                            " just it is not showing up under /usr/include" - as I already told you b efore the libraries will NOT show up in that directory. Search for the qt5 libs like I suggested before:

                            find /usr/lib -name *qt5*
                            find /usr/lib64 -name *qt5*
                            

                            Don't forget to also change include folders in your set-up as currently you use qt4 include folder.

                            https://forum.qt.io/topic/113070/qt-code-of-conduct

                            M 1 Reply Last reply
                            0
                            • jsulmJ jsulm

                              @micha_eleric said in how to fix linker error in eclipse on linux:

                              i already installed qt5

                              What exactly? Which qt5 packages?
                              " just it is not showing up under /usr/include" - as I already told you b efore the libraries will NOT show up in that directory. Search for the qt5 libs like I suggested before:

                              find /usr/lib -name *qt5*
                              find /usr/lib64 -name *qt5*
                              

                              Don't forget to also change include folders in your set-up as currently you use qt4 include folder.

                              M Offline
                              M Offline
                              micha_eleric
                              wrote on last edited by
                              #16

                              @jsulm said in how to fix linker error in eclipse on linux:

                              find /usr/lib -name qt5

                              michaeleric@michaeleric-C7B250-CB-ML:/usr/lib$ find -name qt5
                              ./qt5
                              ./x86_64-linux-gnu/qt5
                              michaeleric@michaeleric-C7B250-CB-ML:/usr/lib$ cd /
                              michaeleric@michaeleric-C7B250-CB-ML:/$ cd /usr/lib64
                              michaeleric@michaeleric-C7B250-CB-ML:/usr/lib64$ find -name qt5
                              michaeleric@michaeleric-C7B250-CB-ML:/usr/lib64$

                              jsulmJ 1 Reply Last reply
                              0
                              • M micha_eleric

                                @jsulm said in how to fix linker error in eclipse on linux:

                                find /usr/lib -name qt5

                                michaeleric@michaeleric-C7B250-CB-ML:/usr/lib$ find -name qt5
                                ./qt5
                                ./x86_64-linux-gnu/qt5
                                michaeleric@michaeleric-C7B250-CB-ML:/usr/lib$ cd /
                                michaeleric@michaeleric-C7B250-CB-ML:/$ cd /usr/lib64
                                michaeleric@michaeleric-C7B250-CB-ML:/usr/lib64$ find -name qt5
                                michaeleric@michaeleric-C7B250-CB-ML:/usr/lib64$

                                jsulmJ Offline
                                jsulmJ Offline
                                jsulm
                                Lifetime Qt Champion
                                wrote on last edited by
                                #17

                                @micha_eleric Please read again what I suggested (hint: * is important)...

                                https://forum.qt.io/topic/113070/qt-code-of-conduct

                                M 1 Reply Last reply
                                0
                                • jsulmJ jsulm

                                  @micha_eleric Please read again what I suggested (hint: * is important)...

                                  M Offline
                                  M Offline
                                  micha_eleric
                                  wrote on last edited by
                                  #18

                                  @jsulm the * was used, copied, pasted, but did not show on post.

                                  jsulmJ JonBJ 2 Replies Last reply
                                  0
                                  • M micha_eleric

                                    @jsulm the * was used, copied, pasted, but did not show on post.

                                    jsulmJ Offline
                                    jsulmJ Offline
                                    jsulm
                                    Lifetime Qt Champion
                                    wrote on last edited by
                                    #19

                                    @micha_eleric Can you please answer questions?
                                    I asked before: What exactly? Which qt5 packages?

                                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                                    M 1 Reply Last reply
                                    0
                                    • jsulmJ jsulm

                                      @micha_eleric Can you please answer questions?
                                      I asked before: What exactly? Which qt5 packages?

                                      M Offline
                                      M Offline
                                      micha_eleric
                                      wrote on last edited by
                                      #20

                                      @jsulm sudo apt-get install qt5-default
                                      from:
                                      https://wiki.qt.io/Install_Qt_5_on_Ubuntu

                                      jsulmJ 1 Reply Last reply
                                      0
                                      • M micha_eleric

                                        @jsulm sudo apt-get install qt5-default
                                        from:
                                        https://wiki.qt.io/Install_Qt_5_on_Ubuntu

                                        jsulmJ Offline
                                        jsulmJ Offline
                                        jsulm
                                        Lifetime Qt Champion
                                        wrote on last edited by
                                        #21

                                        @micha_eleric On my Ubuntu machine Qt5 libs are in /lib/x86_64-linux-gnu
                                        Like /lib/x86_64-linux-gnu/libQt5Widgets.so.5

                                        https://forum.qt.io/topic/113070/qt-code-of-conduct

                                        1 Reply Last reply
                                        0
                                        • M micha_eleric

                                          @jsulm the * was used, copied, pasted, but did not show on post.

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

                                          @micha_eleric said in how to fix linker error in eclipse on linux:

                                          @jsulm the * was used, copied, pasted, but did not show on post.

                                          find /usr/lib -name *qt5*
                                          find /usr/lib64 -name *qt5*
                                          

                                          You must quote these from the shell's expansion:

                                          find /usr/lib -name '*Qt5*'
                                          find /usr/lib64 -name '*Qt5*'
                                          

                                          Or you might find this useful:

                                          locate Qt5
                                          
                                          jsulmJ 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