Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Compile/Running in terminal and keep getting same error - Ubuntu 14.04



  • Hey guys,
    I keep trying to compile in Terminal but am running into the same error. It says that <QGLWidget> doesnt exist. I have added QtOpenGl to my header, as well as my main.cpp. I have added the proper command to the .pro file, and added an INCLUDEPATH to the actual qt project itself. But I still end up with the exact same error. Below is my command in Terminal, and then its response:

    sam@sam-VirtualBox:~/Downloads$ "/home/sam/Downloads/qt-everywhere-opensource-src-4.8.5/bin/qmake" '/home/sam/Qt5.0.2/5.0.2/gcc/examples/opengl/2dpainting/2dpainting.pro' -r CONFIG+=debug -spec /home/sam/Downloads/qt-everywhere-opensource-src-4.8.5/mkspecs/qws/linux-arm-gnueabi-g++
    sam@sam-VirtualBox:~/Downloads$ make
    /home/sam/Downloads/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/bin/arm-linux-gnueabihf-g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -Iqt-everywhere-opensource-src-4.8.5/mkspecs/qws/linux-arm-gnueabi-g++ -I../Qt5.0.2/5.0.2/gcc/examples/opengl/2dpainting -I/usr/local/Qt-4.8.5-arm/include/QtCore -I/usr/local/Qt-4.8.5-arm/include/QtNetwork -I/usr/local/Qt-4.8.5-arm/include/QtGui -I/usr/local/Qt-4.8.5-arm/include/QtOpenGL -I/usr/local/Qt-4.8.5-arm/include -I/home/sam/downloads/qt-everywhere-opensource-src-4.8.5/include/QtOpenGL -I. -I../Qt5.0.2/5.0.2/gcc/examples/opengl/2dpainting -I. -o glwidget.o ../Qt5.0.2/5.0.2/gcc/examples/opengl/2dpainting/glwidget.cpp
    In file included from ../Qt5.0.2/5.0.2/gcc/examples/opengl/2dpainting/glwidget.cpp:41:0:
    ../Qt5.0.2/5.0.2/gcc/examples/opengl/2dpainting/glwidget.h:44:21: fatal error: QGLWidget: No such file or directory
    #include <QGLWidget>
    ^
    compilation terminated.
    make: *** [glwidget.o] Error 1

    Really appreciate any comments/help!!!

    Cheers



  • Is it possible that you forgot to add the OpenGL module in your *.pro file?

    QT += opengl
    

    Edit: You stated that you "added the proper command to the *.pro file". Looking at the documentation it seems like that was only added for Qt 5 while judging from your output you are using Qt 4.8:


  • Lifetime Qt Champion

    Hi,

    To add to @Joel-Bodenmann, watch out, you are trying to build Qt 5 examples with Qt 4. Not that it's not possible but you may have surprises.


Log in to reply