Click to See Complete Forum and Search --> : GLUT issues, cannot link!


pythagras
02-25-2003, 09:46 PM
Ok, I installed redhat's glut and glut-devel packages off their FTP. I tried compiling a small program we have to for my CG class to test if things work ok.

Anywho, it compiles ok, but wont link! g++'s output gives me a whole lot of:

# g++ -o shapes shapes.o
shapes.o: In function `display()':
shapes.o(.text+0xf): undefined reference to `glClear'
shapes.o(.text+0x1c): undefined reference to `glBegin'
shapes.o(.text+0x30): undefined reference to `glColor3f'
shapes.o(.text+0x3f): undefined reference to `glVertex2i'
shapes.o(.text+0x53): undefined reference to `glColor3f'
.
.
.
(with a million more)

The shared libraries (libglut.so and such) are in the right place, and glut.h obviously exists and will compile. I have GL and GLU...

Whats the problem!??! Ive been working on this for hours.

RH 8..

pythagras
02-25-2003, 10:07 PM
Solution: link with the "-lglut" option. Apparently this points the linker toward the magical world of glut.

$ g++ -o shapes shapes.o -lglut

bwkaz
02-26-2003, 10:50 AM
Or rather, link with -lglut -lGLU -lGL

You need the glut support libraries, as well; glClear, glColor3f, etc. are all in libGL, which -lglut will not bring in.