ld: "cannot find -lGLU"
Hi - I don't normally use GLU all that often. However, now I want to write a game which uses a Perspective camera, and since virtually every machine used for games in existence comes with GLU, I don't see any harm in using it myself. I tried compiling a simple starter app with -lGLU and I got an error from the linker "cannot find -lGLU". At first, I thought that I might not have GLU on my system, so I looked on Mesa's website for information about GLU. I discovered that GLU comes with the latest versions of Mesa, so I downloaded the latest version, compiled (I think it automatically installs). ls /usr/X11R6/lib/libGLU* comes up with /usr/X11R6/lib/libGLU.so /usr/X11R6/lib/libGLU.so.1 /usr/X11R6/lib/libGLU.so.1.3 /usr/X11R6/lib is in my /etc/ld.so.conf and I have run ldconfig Nevertheless, I am still getting this weird error message. Does anyone know what's wrong?
Zorx (a Puzzle Bobble clone)Discontinuity (an animation system for POV-Ray)
g++ -o game main.cc implementation.cc -lGL -lSDL -lGLU
or, in fact,
g++ -lGLU
I also have a CFLAGS and CXXFLAGS set to -O3 -march=pentium4 (EDIT: I realized that doesn't make a difference because I'm not using CFLAGS or CXXFLAGS or even a Makefile.)
[Edited by - clum on June 20, 2004 11:03:16 PM]
or, in fact,
g++ -lGLU
I also have a CFLAGS and CXXFLAGS set to -O3 -march=pentium4 (EDIT: I realized that doesn't make a difference because I'm not using CFLAGS or CXXFLAGS or even a Makefile.)
[Edited by - clum on June 20, 2004 11:03:16 PM]
Zorx (a Puzzle Bobble clone)Discontinuity (an animation system for POV-Ray)
Can someone run ls /usr/X11R6/lib/libglu* to see if I'm missing something important?
EDIT: Is it possible that I need the .a and .al files even though I'm just using g++ -lGLU?
[Edited by - clum on June 20, 2004 11:45:07 PM]
EDIT: Is it possible that I need the .a and .al files even though I'm just using g++ -lGLU?
[Edited by - clum on June 20, 2004 11:45:07 PM]
Zorx (a Puzzle Bobble clone)Discontinuity (an animation system for POV-Ray)
Have you tried adding "-L/usr/X11R6/lib" to the g++ command line.
-L informs g++ to look -L<here> for libs as well as standard places.
You may also need to add "-I/usr/X11R6/include"
-L informs g++ to look -L<here> for libs as well as standard places.
You may also need to add "-I/usr/X11R6/include"
Bizzarely enough, that -L did work! I'm certain that I have the correct /etc/ld.so.conf and that I ran ldconfig (I checked a few times). I wonder how I can get it so I don't have to time that long thing everytime (besides making a Makefile - its just so ugly even if I do use a Makefile).
Zorx (a Puzzle Bobble clone)Discontinuity (an animation system for POV-Ray)
The ld cache is for shared libs. Programs will look this file up at runtime to match objects they contain with the libs listed in the ld cache. Object squigle equals /usr/local/lib/foobar.so or something like that.
I think the Makefile is the best bet. You could add the linker flag to your global CFLAGS or CXXFLAGS if you wanted. Personally I think the cleanest and portable friendly method is using a Makefile.
I think the Makefile is the best bet. You could add the linker flag to your global CFLAGS or CXXFLAGS if you wanted. Personally I think the cleanest and portable friendly method is using a Makefile.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement