Trouble with glut?

I have a problem installing glut 3.7 on my mandrake 7.2 box with a tnt2m64. It apparently installs ok, but when i try to compile my program (torus.c from the Opengl Redbook) i get the following:

gcc -o torus torus.c -lGL -lGLU -lglut

/usr/lib/ undefined reference to XGetExtensionVersion' /usr/lib/ undefined reference to XFreeDeviceList’
/usr/lib/ undefined reference to XQueryDeviceState' /usr/lib/ undefined reference to XListInputDevices’
/usr/lib/ undefined reference to XFreeDeviceState' /usr/lib/ undefined reference to XOpenDevice’
/usr/lib/ undefined reference to XmuLookupStandardColormap' /usr/lib/ undefined reference to XSelectExtensionEvent’
collect2: ld returned 1 exit status

What is wrong here???

i think your missing some crucial libraries to link to?

Perhaps do you want to use the glut from mesa since it allows you to build with your command. The original glut seems to require that you give a lot of other libraries. See

I usually program under visual c++ but I’ve programed once in CIGWIN and it gave problems. The resolution was to write:

gcc -o torus torus.c -lglut -lglu -lgl

instead of:

gcc -o torus torus.c -lGL -lGLU -lglut

Try it!!

You’ll need other libs as well as the glut and gl libs …

add in to your link command line

-lX11 -lXi -lXmu -lm


This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.