mesa on linux

I installed mesa 2.6 in my linux 5.2, the headers files are in
/usr/include/GL/* (including gl.h, glu.h, glut.h, etc)
but when I am making a sample program to test GL, using the command

gcc a.c

the compiler says:
/tmp/cca002661.0:In function ‘main’
/tmp/cca002661.0 (.text+0xc); undefined reference to ‘glutInit’).
/tmp… (same thing repeated) (whatever glut func.
.
.
.
what is the problem? what can I do?
From Alan.

Where abouts are the GL LIB’s ?, or whatever the linux equivalent is? I usually get that error when a compiled function cannot be found, sorta like not linking opengl32.lib when making a win32 openGL app.

Sorry if you’ve already checked for this, but some answers are so simple its easy to just overlook them

drakaza is right. You need to include the GL libraries on your compile (accually link) line.

you want to do something like
gcc a.c -L/usr/local/Mesa-2.6/lib -lGL -lGLU -lglut

that should clear it up for you.

-Marrcke

[This message has been edited by Marrcke (edited 06-24-2000).]

I just did the same thing as alan, but with with the above command line and I added:

-O -o hello

but I get the following error
./hello: error in loading shared libraries: libGL.so.1 cannot open shared object file: No such file or directory

I should also comment that this error occurs after compiling, linking, when I try to ./hello

> ./hello: error in loading shared libraries: libGL.so.1 cannot open shared
> object file: No such file or directory

this means that it can’t find the library at execution time.
That’s controled by /etc/ld.so.conf. You need to add the location of the
libGL.so.1 to that list and run ldconfig. I always delete /etc/ld.so.cache
before I run ldconfig, but I’m pretty sure that’s not necessary.

-Marrcke
Marc Meyer

I solved my problem earlier, but using not good way.
I code my program in the demos directory, add the simbol in that directory’s makefile.
then “make linux”. the makefile there will help you to use the approprieate command to compile. and it works!
but I took at look at the makefils and make-config, there are so many options for compiling, even only in linux. can anyone help me to point out which one is useful and which one is not? what shall I do? copy the exactly makefile to my own directory, or what else?
thankx.
From Alan.

eh? I usually use

g++ code.c -O -lGL -lGLU -lglut -o code

don’t worry about the other options =D

then just do ./code