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: need help compiling (beginner help!)

  1. #1
    Junior Member Newbie
    Join Date
    Mar 2004
    Posts
    4

    need help compiling (beginner help!)

    Okay, ive spent all day setting up Debian. I know a lot about computers, but nearly nothing about linux.

    I installed the most recent xserver-xfree86 software, and set up a KDE windows manager.

    I downloaded NEHE's first tutorial for linux, and tried to compile it, and gcc cant find

    GL/glut.h
    GL/gl.h
    GL/glu.h

    i know theres somthign simple i can do, but i have no idea what. how can i get gcc to find these files? theyre supposed to come installed right? i apt-get install mesademos to get glut, but it still doesnt find htat.

    code-

    #include <GL/glut.h>
    #include <GL/gl.h>
    #include <GL/glu.h>
    ... etc (havnt even got to this part yet )

    Thanks!

    oliver

  2. #2
    Junior Member Newbie
    Join Date
    Mar 2004
    Location
    Vancouver, Canada
    Posts
    21

    Re: need help compiling (beginner help!)

    ok, this is noob to noob

    no guarantees

    make sure you have all the "developer" stuff installed during your initial setup

    open the file in the editor of your choice

    (I'm on Fedora and I use Kate)

    on the command line do the following

    gcc -o test name_of_file.c -lglut

    hope that helps

  3. #3
    Junior Member Newbie
    Join Date
    Mar 2004
    Location
    Vancouver, Canada
    Posts
    21

    Re: need help compiling (beginner help!)

    oops

    make sure you check that you have glut on your system

    somelse mentioned that glut 3.7-8 is the one to get

    glut.h usually lives at /usr/include/GL

    and libglut at /usr/lib

    cheers

  4. #4
    Senior Member OpenGL Pro
    Join Date
    Oct 2000
    Location
    Fargo, ND
    Posts
    1,755

    Re: need help compiling (beginner help!)

    Did the error say that the header files were not found, or that the functions you used were "undefined." They are 2 very different errors.

    If you don't have the GL headers in /usr/include/GL, you might have them someplace like /usr/X11R6/include/GL, and if that is the case, you may need to include -I/usr/X11R6/include on the command line...

    The next problem that you will likely run into is linker errors caused by not specifying the libraries you need to link. You do that by using the -l option. If the library is named libGL.so, the -l option looks like -lGL. So for OpenGL libraries, you generally need -lGL -lGLU, and -lglut if you are using glut.

    Again, the GL libraries might be found in /usr/X11R6/lib if they aren't in /usr/lib. If that is the case you may need to add -L/usr/X11R6/lib.

    Sometimes you may get undefined errors to other X functions, and will need to include those libraries as well. (-lXi and -lXmu are commonly needed). One way I use to check what library a function is in, is by executing the following:

    grep functionName /usr/lib/*

    or

    grep functionName /usr/X11R6/lib/*

    So, in summary, you may end up having a command line that looks like so:
    gcc -o myprog myprog.c -I/usr/X11R6/include -L/usr/X11R6/lib -lGL -lGLU -lglut -lXi -lXmu
    Deiussum
    Software Engineer and OpenGL enthusiast

  5. #5
    Advanced Member Frequent Contributor
    Join Date
    Apr 2003
    Posts
    680

    Re: need help compiling (beginner help!)

    you should simply check manually if these files are present.. located at /usr/include/GL/... if they are, fine, if not, install them. OpenGL header files can be found at

    http://oss.sgi.com/projects/ogl-sample/registry/

    Jan

Posting Permissions

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