[solved]unable to compile 'accum.c' example in Linux

trying this:

#gcc -c accum.c
#gcc accum.o /usr/lib/libglut.so /usr/lib/opengl/xorg-x11/lib/libGL.so

results in:
/usr/lib/libglut.so: undefined reference to gluErrorString' /usr/lib/libglut.so: undefined reference togluNewQuadric’
/usr/lib/libglut.so: undefined reference to gluQuadricDrawStyle' /usr/lib/libglut.so: undefined reference togluCylinder’
/usr/lib/libglut.so: undefined reference to gluQuadricNormals' /usr/lib/libglut.so: undefined reference togluSphere’
collect2: ld returned 1 exit status

What is wrong? Maybe another “*.so” to link?

you don’t have to add the full library path if you use the -l flag, and you don’t need to call gcc twice. try

gcc -o accum accum.c -lX11 -lglut -lGL -lGLU

if a special lib is not in the default library path, you can extend the library path:

gcc -L/usr/lib/opengl/xorg-x11/lib -o accum accum.c -lX11 -lglut -lGL -lGLU

I’ve just found the same.