Problem linking GLUT

I have read many messages about GLUT problems on this forum but none of them were like the one I’m having. I just got X4.1.0 installed on my system, and my OpenGL is working fine for running programs like gears. When I first tried to compile a simple OpenGL/Glut program, I found that glut.h was not on my system. I got a copy of it and placed it in my include directory. I am now able to compile, but when gcc attempts to link the program I get the following error:

/usr/bin/ld: cannot find -lglut
collect2: ld returned 1 exit status

The file /usr/X11R6/lib/ is present and is a symbolic link to /usr/X11R6/lib/

I did a ldconfig -p and found the following line: (libc6) => /usr/X11R6/lib/

Why can’t gcc/ld find the library? Here is the makefile I’m using:

INCLUDE = -I/usr/X11R6/include/
LIBDIR = -L/usr/X11R6/lib/

CC = gcc
LIBRARIES = -lGL -lGLU -lglut -lX11 -lXi -lXmu -lXext -lm

All: cube

cube: cube.o

Any help would be greatly appreciated.
Steve C.

I usually make a link for to and you should find that this works without any problems.

Neil Witcomb


That did it!

Thanks a lot for your help,
Steve C.

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