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/libglut.so.3 is present and is a symbolic link to /usr/X11R6/lib/libglut.so.3.7.0.

I did a ldconfig -p and found the following line:

libglut.so.3 (libc6) => /usr/X11R6/lib/libglut.so.3

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
CFLAGS = (COMPILERFLAGS) (INCLUDE)
LIBRARIES = -lGL -lGLU -lglut -lX11 -lXi -lXmu -lXext -lm

All: cube

cube: cube.o
(CC) (CFLAGS) -o @ (LIBDIR) < (LIBRARIES)

Any help would be greatly appreciated.
Steve C.

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

Neil Witcomb

Neil,

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.