Solved Help! Problem with Qt and OpenGL (fatal error)
-
Hello, I was trying to compile an OpenGL with qt program for the first time and i had some issues in the process
As I said, that was the first time in this machine, but I'd did that in another one, the process was:
write "qmake-qt4", then a Makefile was created, and then do the "make", to do the Makefile works.
But when I wrote "make", this appears to the console:g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL -I/usr/include/qt4 -I/usr/include/glm -I/usr/X11R6/include -I. -I. -o main.o main.cpp
main.cpp:1:10: fatal error: QApplication: No such file or directory
#include <QApplication>
^~~~~~~~~~~~~~
compilation terminated.
Makefile:226: recipe for target 'main.o' failed
make: *** [main.o] Error 1All I did for this It was:
sudo apt install qtchooser
and:
sudo apt install qt4-qmakeI dont know what else can I do, I tried in another machine, but the error Is the same, except instead of <QApplication>, It wrote <QOpenGLFunctions_3_3_Core>
Thank you for your time!
-
You did not install the qt4 development package so the include files are not installed (and therefore not found by the compiler).
btw: I would strongly advise to not use Qt4 but Qt5 instead. -
@Christian-Ehrlicher thank you for the answer!
Hoe can I download the qt4 package? or the qt5? Thank u -
Why did you delete your first post? Since I don't know your distribution I can't help.
-
The Qt 4 headers and libraries would be installed by (Ubuntu 16.04)
sudo apt install libqt4-dev
For Qt 5, the modules are split in several packages. But you can also install any Qt 5 version with the online installer: https://download.qt.io/official_releases/online_installers
Regards
PS: Please don't delete your posts, especially not if you got an answer.
Thanks
-
Sorry guys, I deleted the post because I found a "solution":
I found in another forum, doingsudo apt-get install qtbase5-dev
sudo apt-get install qt5-defaultto get the qmake-qt5,
but I sill cannnot do de "qmake-qt5", so I decided to do it just in "qmake", that's works, but now I have another problem. The new problem I posted here:
https://forum.qt.io/topic/94893/help-qopenglshader-unable-to-open-file-shaders-fragshad-frag-qopenglshader-unable-to-open-file-shaders-vertshad-vertI have Ubuntu 18.04.
Now Im going to try It in qt5, as @aha_1980 said, thanks guys. :-) -
Hi @JRefusta,
thanks for sharing the answer. The reason to keep the question and to share the answer is to help further readers, just like you found your solution.
So please mark this topic as SOLVED now. Thanks!