PDA

View Full Version : Undefined reference to 'glut*****'



Joseph Teo
02-12-2004, 07:13 AM
When I compile my source code. The below error come up:
gcc -I/usr/X11R6/include/ -o myWindow -L/usr/X11R6/lib -L/usr/lib/libglut.so.3
myWindow.o -lGL -lGLU -lX11 -lXmu -lXi -lXext -lm
myWindow.o: In function `main':
myWindow.o(.text+0xa5): undefined reference to `glutInit'
myWindow.o(.text+0xb2): undefined reference to `glutInitDisplayMode'
myWindow.o(.text+0xc7): undefined reference to `glutInitWindowSize'
myWindow.o(.text+0xd9): undefined reference to `glutInitWindowPosition'
myWindow.o(.text+0xe9): undefined reference to `glutCreateWindow'
myWindow.o(.text+0xf9): undefined reference to `glutDisplayFunc'
myWindow.o(.text+0x109): undefined reference to `glutMouseFunc'
myWindow.o(.text+0x116): undefined reference to `glutMainLoop'
collect2: ld returned 1 exit status
make: *** [myWindow] Error 1

Any idea how to solve this undefined reference to 'glut***'?

pleopard
02-12-2004, 12:00 PM
try this ...

-L/usr/X11R6/lib -L/usr/X11R6/lib -lglut -lm -lGLU -lGL -lXmu -lXext -lX11


[This message has been edited by pleopard (edited 02-12-2004).]

sedak
02-13-2004, 06:17 AM
do:
ln -s /usr/lib/libglut.so.3 /usr/lib/libglut.so

then
gcc -I/usr/X11R6/include/ -o myWindow -L/usr/X11R6/lib myWindow.o -lGL -lGLU -lX11 -lXmu -lXi -lXext -lm -lglut

Methodz
02-13-2004, 08:41 AM
Im having the same problem with undefined references...

Does anyone know how I set the paths for libraries in Kdevelop so I dont get these undefined reference errors?

dorbie
02-16-2004, 01:10 AM
-L only specifies a path, -l actually links, you are using -L to specify a link file with an absolute path that explicitly includes a dynamic lib (with the full extension and version no less which is also bad).

That's 3 threads here where people can't link a library!


[This message has been edited by dorbie (edited 02-16-2004).]

bunny-3110
02-16-2004, 01:54 AM
Hello
I would develop with Red hat 7.3 and i will know where find the library GLUT give me link please it's very important for my job because I can't develop without the lib in OpenGL tks

dorbie
02-16-2004, 07:24 PM
http://www.opengl.org/resources/libraries/glut/glut_downloads.html
http://freeglut.sourceforge.net/

bunny-3110
02-17-2004, 04:04 AM
tks for your answer :-)