compiling in linux

my libraries condiction: mesa 2.6, xform 0.99, XFree86 3.3.2.3, linux RH 5.2

when I am compiling with xforms and mesagl together using g++ -O0 …(other options)
it says
/usr/lib/libMesaGL.so: undefined reference to ‘XShmDetach’
/usr/lib/libglut.so: undefined reference to ‘XGetExtensionVersion’
.
.
.

what happen?

if I get rid of -L…/lib -glut -lMesaGLU -lMesaGL when I am linking the object files.
it compiles well. however, when I am trying to run the execute file, like ./a.out
it would say:
Sorry, no matching visuals found.
What is this? A palm pilot?

what should I do? should I upgrade the mesa2.6 to mesa3.2? (since I saw missing 'XGetExtensionVersion, is it a hint?)

Thankx.
From Alan.

Maybe you forgot some other X library?
these are the lib I link with:

-lglut -lGLU -lGL -lm -lX11 -lXext -lXmu

you might want to change -lGLU and -lGL to -lMesaGLU and -lMesaGL.

John

my compile commands are:
$g++ -c -I…/include -O2 -I/usr/X11R6/include -I…/FORMS File1.cpp
(same things for File2.cpp, File3.cpp …)
$g++ File1.cpp File2.cpp … Filex.cpp -o a.out -L…/lib -lglut -lMesaGLU -lMesaGL -lm -L…/FORMS -lforms -L/usr/X11/lib -L/usr/X11R6 -lX11 -LXext -lXmu -lXt -lXi -lSM -lICE
$./a.out

it says:
Sorry, no matching visuals found.
What is this? A palm pilot?

recall that I copied from what MesaGL’s and xforms’s Makefiles. Those two Makefiles works fine in each individuals.

the File1.cpp … Filex.cpp works well in Unix system under sgi O2 machine because they are my class project.

I original thought I have too many options. so I tried the following shortest one:
$g++ -c File1.cpp
$g++ -c File2.cpp
$…
$g++ -c Filex.cpp
$g++ -o a.out -L…/FORMS -lforms -L/usr/X11/lib -lX11

it compiles fine as the longer one, but the result is the same as before:
Sorry, no matching visuals found.
What is this? A palm pilot?

I wonder if it’s my vedio card’s problem, or the version of the X11(3.3.2.3), MesaGL(2/6), or Xforms(0.89)'s problems.

what does “matching visuals” mean?

did I miss any options I shouldn’t miss?
well, it compiles well; it’s not my codes’ problems. I have focus on it for a long time but I have no clue what is going on.

can somebody help me?
Thankx very much.
From Alan.