PDA

View Full Version : [solved]unable to compile 'accum.c' example in Linux



noob
02-28-2006, 03:02 AM
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 to `gluNewQuadric'
/usr/lib/libglut.so: undefined reference to `gluQuadricDrawStyle'
/usr/lib/libglut.so: undefined reference to `gluCylinder'
/usr/lib/libglut.so: undefined reference to `gluQuadricNormals'
/usr/lib/libglut.so: undefined reference to `gluSphere'
collect2: ld returned 1 exit status
---------------
What is wrong? Maybe another "*.so" to link?

RigidBody
02-28-2006, 03:14 AM
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

noob
02-28-2006, 03:18 AM
thanx.
I've just found the same.
http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=4;t=000259