PDA

View Full Version : linux files & how to compile



08-27-2002, 08:03 AM
hi

With reference to my earlier posting(http://www.opengl.org/discussion_boards/ubb/Forum2/HTML/009627.html) 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\

thanks
simon

john
08-27-2002, 03:56 PM
Howdy,

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:



gcc myopenglfile.c -I/usr/include -L/usr/lib -lgl -lglu -lglut

I hope this helps

cheers,
John