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 5 of 5

Thread: Compiling with gcc

  1. #1
    Guest

    Compiling with gcc

    Hello, I am trying to compile the first sample program from the redbook. Located in the programming guide link.

    It has these 2 include statements.

    #include <GL/gl.h>
    #include <GL/glut.h>

    I try to compile with this command: (Note I am using slackware 10.1)

    gcc -lGLUT -lGL -o sample sample.c

    Is anything wrong with this?
    I get this error:

    /usr/lib/gcc-lib/i486-slackware-linux/3.3.4/../../../../i486-slackware-linux/bin/ld: cannot find -lGLUT
    collect2: ld returned 1 exit status

    I have GLUT 3.7. Infact it comes with slackware 10.1. How nice! But I dont know how to use it yet.
    Any help would be appreciated.

    Beezer

  2. #2
    Junior Member Newbie glBug's Avatar
    Join Date
    Oct 2004
    Location
    Canberra, ACT
    Posts
    29

    Re: Compiling with gcc

    you have to specify a "library path", look where is libglut.so on your system [I put my one into /usr/local/lib ] and supply the library path to gcc:
    in my case: gcc mycrap.c -L/usr/local/lib -L/some/other/lib/path -lglut -lother

    and be careful about case-sensitivity: libGLUT, libglut, libGlut are three different names!

  3. #3
    Junior Member Newbie
    Join Date
    Aug 2005
    Posts
    1

    Re: Compiling with gcc

    In fact the good command is :
    gcc arbfplight.c -o arbfplight -L/usr/X11R6/lib/ -lGL -lGLU -lglut

  4. #4
    Senior Member OpenGL Pro
    Join Date
    Jul 2001
    Location
    France
    Posts
    1,663

    Re: Compiling with gcc

    Be careful ! GLUT is not the same thing as glut.

  5. #5

    Re: Compiling with gcc

    I try "gcc hello.c -o hello -L/usr/X11R6/lib/ -lGL -lGLU -lglut", all good, realy work ! (I work in Slackware)

Posting Permissions

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