Important: Please read the Qt Code of Conduct -

Using OpenGL within QT, novice Linux user

  • Centos Linux
    I am using QT Designer from Trolltech version 3.3.8b, the goal is to create a window/panel with an OpenGL display within the QT display. The QT part seems to be fine, it’s the GL part that is a problem.

    A tutorial specified to add the two options for lib:
    -lglut –lglu
    G++ says that it cannot find –lglu. It does appear to find –lglut
    In path /usr/include/GL there are about 17 files to include glu.h, gl.h, glut.h, and more.

    From directory /usr/lib64 issue the command:
    ls –al
    to get
    lrwxrwxrwx 1 root root 15 Oct 25 10:23 ->
    I interpret that as indicating that it exists.
    When the -lglu is removed the error is gone but then I must comment out almost everything GL related

    I tried looking at environment variables $LIB, $LIBRARY, $LD_LIBRARY_PATH, $LIBPATH, and $SHLIB_PATH but none exist.
    Any suggestions as to where I might look or what I might do to resolve this problem.

  • Lifetime Qt Champion


    Do you really have to use Qt 3.3.8b ?

  • Unfortunately yes. I am on a government project and the project manager(s) take the position that since it works and does what is needed we are not going to spend money and time to upgrade.

  • Lifetime Qt Champion


    You need to install the libglu development package if not already on your system.

  • In my OP I noted that something like that was found. Here is the result of: ls al
    lrwxrwxrwx 1 root root 15 Oct 25 10:23 ->

    Is there something else I should look for?

  • Lifetime Qt Champion

    My bad, I misread.

    Did you try with -lGLU ?

  • I have tried
    -lglu –lglut // returned cannot fine -lglu
    LGLU –LGLUT // returned undefined reference to 'glClear'
    -Lglu -lGLUT // returned cannot find lGLUT

  • Lifetime Qt Champion

    Keep l lowercase, it's not the same signification for the linker. -L adds a folder to the search path of the linker while -l is to add a library to link to.

  • Did a few more, and maybe some duplicates from earlier.
    -lglut undefined reference to glClear
    -lglut -lglu cannot find -lglu
    -lglut -lGLU undefined reference to glClear

    the -lglu and -lGLU appear to provide nothing.

  • Lifetime Qt Champion

    glClear is provided by the OpenGL library. You are missing -lGL.

  • Ok, that worked and I am on my way again.
    Thank you for your time and patience.

Log in to reply