Results 1 to 2 of 2

Thread: linux files & how to compile

  1. #1

    linux files & how to compile


    With reference to my earlier posting( I somehow installed redhat linux6.0 in my PC.

    Problems are

    1. I tried to compile using gcc command(gcc filename). The error message is

    gl.h : no such file or directory
    glu.h: no such file or directory
    glut.h no such file or directory

    (i'm using those files in my code)

    I already downloaded those files(not sure whether it's correct one).

    2. do i have use link option while using gcc command? How to use it?

    header files are in \usr\include\gl\


  2. #2
    Senior Member Frequent Contributor
    Join Date
    Apr 2000
    Adelaide, South Australia, Australia

    Re: linux files & how to compile


    you'll have to learn gcc. Try 'man gcc' from your shell and be prepared for an insanely long doc.

    Anyway; a brief overview to answer your questions:

    you need to tell gcc where to find the 'extra' files it needs to compile:

    1) you specify the include path with -I<path>:<anotherpath>:<etc>. The include path is searched for files you #include<here>.

    2) you specifiy the library path with -L<path>:<etc>. The library path is searched for libraries you link in with -l<lib> from the command line.

    The answer to your second question depends on how tricky you want to be when compiling. gcc thefile.c will compile and then link thefile.c into a.out. You can tell gcc to NOT link (with the -c option) so you'll just get thefile.o. If you call gcc thefile.o, then gcc will link it for you. (You might want to delay linking if you have a large project... but thats another story.)

    If your gl files are included in /usr/include/gl/gl*.h (and you #include them by specifiying the gl directory with #include<gl/gl.h> ) then I really don't understand why gcc isn't automagically searching /usr/include. It should because other useful files like math.h and stdio.h are kept there, also. You could try this and see if it works:

    Code :
    gcc myopenglfile.c -I/usr/include -L/usr/lib -lgl -lglu -lglut
    I hope this helps


Similar Threads

  1. Will CPW compile on Mac OS X and Linux?
    By AlainODea in forum OpenGL: General
    Replies: 4
    Last Post: 04-02-2002, 12:37 PM
  2. Replies: 5
    Last Post: 07-02-2001, 08:13 PM
  3. How do you compile on Linux....
    By LaptuaZ in forum OpenGL: Linux
    Replies: 2
    Last Post: 06-17-2001, 09:52 AM
  4. linux compile
    By in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 01-26-2001, 11:54 AM
  5. Replies: 2
    Last Post: 01-15-2001, 06:17 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Proudly hosted by Digital Ocean