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. fatal error: QXxxXxx: No such file or directory (and other problems)
Forum Updated to NodeBB v4.3 + New Features

fatal error: QXxxXxx: No such file or directory (and other problems)

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 3.0k 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.
  • K Offline
    K Offline
    kanito73
    wrote on 12 Jan 2020, 02:27 last edited by
    #1

    Hello everybody

    I am trying to build the example from Examples/qmake/tutorial (hello.*) but I'm having troubles IN LINUX (Debian).

    1. The Makefile generated by qmake fails at compile time since it is not able to find some Q_header_file(.h)... I had to edit manually the Makefile and add -I/opt/Qt/.../include/QtXXXX (where XXXX is the name of the module where the expected header file belongs to) to the INCPATH variable...

    2. After the include issue was fixed and the program is compiled, the link also fails indicating "undefined reference to..." and lists QApplication, QWidget, QPushButton etc. I had to add manually -lQt5QtWidgets to the LIBS variable. Then finally builds the binary and it executes correctly.

    I have tried to use the Qt5 (5.11.3) installed from the Debian repositories (libqt5* qt5* qmake*) but it does not work. I must edit the Makefile to add the entries that qmake did not add. After "hacking" the Makefile it builds the program, but qmake is supposed to do that.

    Then I installed the "official" Qt from qt.io (online installer) at /opt/Qt and fixed PATH=/opt/Qt/5.12.6/gcc_64/bin:$PATH and LD_LIBRARY_PATH=/opt/Qt/qt5/gcc_64/lib in a console to build the same Examples/qmake/tutorial and I have the same problem with INCPATH and LIBS variables in the Makefile, I have to add manually QtWidgets header directory and library, then it compiles but at link stage fails because can't find GL library (-lGL), maybe I have to add the library directory that contains libGL* but did not try yet...

    Why 'qmake' is not adding all the required directories? It only adds support for Qt5 GUI and CORE (headers and libraries) but nothing else...

    I am following this tutorial: https://doc.qt.io/qt-5/qmake-tutorial.html and want to build some programs in console by using qmake and editing my programs manually...

    Thanks for your comments or help

    J 1 Reply Last reply 12 Jan 2020, 09:12
    0
    • C Offline
      C Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 12 Jan 2020, 07:56 last edited by
      #2

      You have to call the correct qmake from /opt/Qt/qt5/bin - do you?

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

      1 Reply Last reply
      1
      • K kanito73
        12 Jan 2020, 02:27

        Hello everybody

        I am trying to build the example from Examples/qmake/tutorial (hello.*) but I'm having troubles IN LINUX (Debian).

        1. The Makefile generated by qmake fails at compile time since it is not able to find some Q_header_file(.h)... I had to edit manually the Makefile and add -I/opt/Qt/.../include/QtXXXX (where XXXX is the name of the module where the expected header file belongs to) to the INCPATH variable...

        2. After the include issue was fixed and the program is compiled, the link also fails indicating "undefined reference to..." and lists QApplication, QWidget, QPushButton etc. I had to add manually -lQt5QtWidgets to the LIBS variable. Then finally builds the binary and it executes correctly.

        I have tried to use the Qt5 (5.11.3) installed from the Debian repositories (libqt5* qt5* qmake*) but it does not work. I must edit the Makefile to add the entries that qmake did not add. After "hacking" the Makefile it builds the program, but qmake is supposed to do that.

        Then I installed the "official" Qt from qt.io (online installer) at /opt/Qt and fixed PATH=/opt/Qt/5.12.6/gcc_64/bin:$PATH and LD_LIBRARY_PATH=/opt/Qt/qt5/gcc_64/lib in a console to build the same Examples/qmake/tutorial and I have the same problem with INCPATH and LIBS variables in the Makefile, I have to add manually QtWidgets header directory and library, then it compiles but at link stage fails because can't find GL library (-lGL), maybe I have to add the library directory that contains libGL* but did not try yet...

        Why 'qmake' is not adding all the required directories? It only adds support for Qt5 GUI and CORE (headers and libraries) but nothing else...

        I am following this tutorial: https://doc.qt.io/qt-5/qmake-tutorial.html and want to build some programs in console by using qmake and editing my programs manually...

        Thanks for your comments or help

        J Offline
        J Offline
        JKSH
        Moderators
        wrote on 12 Jan 2020, 09:12 last edited by
        #3

        Hi @kanito73, once you configure your project correctly you shouldn't need to manually edit the Makefile anymore.

        @kanito73 said in fatal error: QXxxXxx: No such file or directory (and other problems):

        I am following this tutorial: https://doc.qt.io/qt-5/qmake-tutorial.html and want to build some programs in console by using qmake and editing my programs manually...

        That tutorial is about using qmake as a generic C++ build tool. It does not contain any Qt-specific elements.

        Why 'qmake' is not adding all the required directories? It only adds support for Qt5 GUI and CORE (headers and libraries) but nothing else...

        To add the Qt Widgets module (headers and libraries) to your project, add this line to your *.pro file before running qmake:

        QT += widgets

        at link stage fails because can't find GL library (-lGL)

        You must install the OpenGL development libraries on your OS. See https://forum.qt.io/topic/67082/ubuntu-16-04-qt-5-6-cannot-find-lgl

        Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

        K 1 Reply Last reply 12 Jan 2020, 13:52
        3
        • J JKSH
          12 Jan 2020, 09:12

          Hi @kanito73, once you configure your project correctly you shouldn't need to manually edit the Makefile anymore.

          @kanito73 said in fatal error: QXxxXxx: No such file or directory (and other problems):

          I am following this tutorial: https://doc.qt.io/qt-5/qmake-tutorial.html and want to build some programs in console by using qmake and editing my programs manually...

          That tutorial is about using qmake as a generic C++ build tool. It does not contain any Qt-specific elements.

          Why 'qmake' is not adding all the required directories? It only adds support for Qt5 GUI and CORE (headers and libraries) but nothing else...

          To add the Qt Widgets module (headers and libraries) to your project, add this line to your *.pro file before running qmake:

          QT += widgets

          at link stage fails because can't find GL library (-lGL)

          You must install the OpenGL development libraries on your OS. See https://forum.qt.io/topic/67082/ubuntu-16-04-qt-5-6-cannot-find-lgl

          K Offline
          K Offline
          kanito73
          wrote on 12 Jan 2020, 13:52 last edited by
          #4

          @JKSH THANKS A LOT! I forgot that little detail, long time I did not program using Qt... I will fix my .PRO file...

          Related to GL, do you have idea of why the Qt from Debian repositories compiles and the Qt from qt.io asks for GL?

          Again, thanks for your help!

          J 1 Reply Last reply 12 Jan 2020, 22:04
          0
          • K kanito73
            12 Jan 2020, 13:52

            @JKSH THANKS A LOT! I forgot that little detail, long time I did not program using Qt... I will fix my .PRO file...

            Related to GL, do you have idea of why the Qt from Debian repositories compiles and the Qt from qt.io asks for GL?

            Again, thanks for your help!

            J Offline
            J Offline
            JKSH
            Moderators
            wrote on 12 Jan 2020, 22:04 last edited by JKSH 1 Dec 2020, 22:04
            #5

            @kanito73 said in fatal error: QXxxXxx: No such file or directory (and other problems):

            Related to GL, do you have idea of why the Qt from Debian repositories compiles and the Qt from qt.io asks for GL?

            All the packages in the Debian repositories are put in place by the Debian maintainers, who specify the full list of dependencies for each package. So, when you download a package from the repo, you automatically download the dependency packages too.

            The installer from qt.io is intended to be used by many different Linux distros, and the different distros structure their repo packages differently. So, the qt.io installer doesn't contain the external dependencies. Users must manually install the dependencies.

            Again, thanks for your help!

            You're welcome!

            Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

            1 Reply Last reply
            1

            5/5

            12 Jan 2020, 22:04

            • Login

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