fatal error: QXxxXxx: No such file or directory (and other problems)
-
Hello everybody
I am trying to build the example from Examples/qmake/tutorial (hello.*) but I'm having troubles IN LINUX (Debian).
-
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...
-
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
-
-
You have to call the correct qmake from /opt/Qt/qt5/bin - do you?
-
Hello everybody
I am trying to build the example from Examples/qmake/tutorial (hello.*) but I'm having troubles IN LINUX (Debian).
-
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...
-
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
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
-
-
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
-
@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!