Important: Please read the Qt Code of Conduct -

#include <GL/glu.h> was removed from QtOpenGL/qgl.h while upgrading from Qt 4.7.3 to 4.8

  • Hi,

    I found that there is a problematic change in the file 'QtOpenGL/qgl.h' when upgrading from 4.7.3 to 4.8.0.
    this line was removed:

    include <GL/glu.h>

    This change introduces lots of errors when I tried to compile any previous codes and libraries related with OpenGL.

    As a banding solution, I manually added it back to 4.8.0 (or return to 4.7.X) and the compilation succeeds and really don't want to modify any headers of GPL or LGPL libraries while I'm compiling them. Shall we return the include statement for the backward compatibility?


  • I include
    #include <QtOpenGL>
    And all works well after install the correct package with aptitude (in on ubuntu)

  • Moderators

    Please consider to "file a bug report": .

    Bug reports automatically end up at the desk of somebody who can actually fix something, forum posts do not.

  • OK, I think I solve the problem by adding the following lines under Line 90 (after the include statement for gl.h):

    @#if defined(Q_WS_MAC)

    include <OpenGL/glu.h>


    ifndef QT_LINUXBASE

    include <GL/glu.h>



    in thee files in the SDK 1.2


    Now I can compile any previous libraries and codes smoothly without hacking any codes.


  • Although I solved the compilation errors, I actually introduced a new problem now. When I launch the compiled application, it launches X-Windows, instead of using OS X OpenGL implementation. When I used Qt 4.7.X, I didn't have this problem. Could you explain why X-windows is launched? Didn't I mess up something?


  • You are probably linking to the X11 version of the underlying GL library. Try running tool -L on the program binary. If X11 is installed on Mac Os X, you end up with GL implementations for X11 and native OSX.

Log in to reply