Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 7 of 7

Thread: compiling problem

  1. #1
    Intern Newbie
    Join Date
    Mar 2002
    Location
    Italy
    Posts
    44

    compiling problem

    HI, i'm new to openGL.
    I have a slackware 8.0 and installed the GLUT library, but i don't have Mesa (where can i find it? is it necessary to use GLUT or not?).

    I tryed to compile a program i found on the glut.column1.ps file i downloaded on opengl.org web page, and i get the followng errors:

    bash-2.05$ make
    gcc -c -o prova.o prova.c
    gcc -o es prova.o -L/usr/X11R6/lib -L/home/galy/GLUT/glut-3.7/lib/glut -lX11 -lm -lGL -lGLU -lglut
    /home/galy/GLUT/glut-3.7/lib/glut/libglut.so: undefined reference to `XGetExtensionVersion'
    /home/galy/GLUT/glut-3.7/lib/glut/libglut.so: undefined reference to `XFreeDeviceList'
    /home/galy/GLUT/glut-3.7/lib/glut/libglut.so: undefined reference to `XQueryDeviceState'
    /home/galy/GLUT/glut-3.7/lib/glut/libglut.so: undefined reference to `XListInputDevices'
    /home/galy/GLUT/glut-3.7/lib/glut/libglut.so: undefined reference to `XFreeDeviceState'
    /home/galy/GLUT/glut-3.7/lib/glut/libglut.so: undefined reference to `XOpenDevice'
    /home/galy/GLUT/glut-3.7/lib/glut/libglut.so: undefined reference to `XmuLookupStandardColormap'
    /home/galy/GLUT/glut-3.7/lib/glut/libglut.so: undefined reference to `XSelectExtensionEvent'

    Bye
    p.s. do i need to include X11?

  2. #2
    Guest

    Re: compiling problem

    Mesas homepage is at http://mesa3d.org/ but it is also included in all distributions. You already have an OpenGL library installed so you do not need Mesa. If you have a NVidia card should you use drivers from their page if not is your installed Mesa library OK.
    You are missing -lXmu at your command line needed by the XmuLookupStandardColormap function. The others missing functions is in -lX11. Try to move -lglut before -lX11. Your order works for me but I can not come up with any other suggestion.
    You do not have to include X11 in your GLUT programs since GLUT takes care of that.

  3. #3
    Intern Newbie
    Join Date
    Mar 2002
    Location
    Italy
    Posts
    44

    Re: compiling problem

    Hi, I installed Mesa and now the compilation works fine.
    I only don't understand why...

    Bye

  4. #4
    Guest

    Re: compiling problem

    Mesa includes GLUT but this version is easier to use because you do not need the X-libraries on the command line. You should now be able to build your program with
    gcc -c -o prova.o prova.c
    gcc -o es prova.o -lm -lGL -lGLU -lglut

    The disadvantage is that you may have overwritten some library and no longer have direct rendering. This can be tested with the glxinfo command.

  5. #5
    Member Regular Contributor nickels's Avatar
    Join Date
    Feb 2000
    Location
    Colorado
    Posts
    298

    Re: compiling problem

    You always want -lX11 after your opengl stuff. Opengl is built on X11, and the linker resolves left to right.

    Sometimes you also have to add -lXext since not all the X functions are in libX11

  6. #6
    Guest

    Re: compiling problem

    GLUT in the Mesa distribution is built in such a way that you do not need -lX11 on the command line. The safe order in the command line is to have the higher levels library before the lower levels libraries that they depend on. The explanation is written here http://users.actcom.co.il/~choo/lupg...tml#link_order

  7. #7
    Intern Newbie
    Join Date
    Apr 2002
    Posts
    30

    Re: compiling problem

    You only have to type
    g++ program.c -o program name -lglut -lm
    -lGL -lGLU
    if you type more you will have errors if you type less you will have errors, you may use gcc

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •