problem with compiling source code

I have problems with it compiling of my openGL source code.

I type in my terminal:
gcc -o cube cube.c -L/usr/X11R6/lib/ -Wall -lX11 -lXi -lXmu -lglut -lMesaGL -lMesaGLU -lm

What kind of problems is gcc reporting?
Examples or error messages would be nice.

I’m not sure it is realy realated but
you should use
-lGL instead of -lMesaGL
-lGLU …

with this your program 'll be able to use hardware acceleration.

if it is a linking problem, as
??? undefined reference to glVertex…

check if you have really the needed librairies in /usr/lib libGL… libGLU
or if you use mesa libMesaGL and libMesaGLU

On my system i have the two with in fact symlink beetween them

When i compile i use:
gcc cube.c cube -L/usr/X11R6/lib -Wall -lX11 -lXext -lXmu -lGL -lGLU -lglut

next time you should give more details, because with this we can’t know if it is a gcc problem or your code