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:
you specify the include path with -I<path>:<anotherpath>:<etc>. The include path is searched for files you #include<here>.
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: