🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

unable to link glut

Started by
3 comments, last by klems 16 years, 2 months ago
I downloaded cg tool kit. When I tried building the example samples, from their location, they built well. When I created a new project, copy pasted the code, I'm unable to link glut. I tried adding the library, in the project options. I can clearly browse libglut.so.3 file. But, in the list, glut is not being displayed. Help me please and I'm using amd64, open suse 10.3 and kdevelop
Gents nandu Intelligents veyrayaa
Advertisement
Do you have the GLUT development packages installed? libsomething.so.somenumber is the runtime component for a library, to link against it you need the development library which is usually named libsomething.la, if memory serves.

I'm not familiar with OpenSUSE's package naming conventions, but it would probably be called libglut-dev or glut-devel or something similar.
Quote: Original post by Valderman
Do you have the GLUT development packages installed? libsomething.so.somenumber is the runtime component for a library, to link against it you need the development library which is usually named libsomething.la, if memory serves.


The linker generally needs /usr/lib/libglut.so, and libtool (of you're using it) would need /usr/lib/libglut.la. If those files are not there you definitely need to install the development package for GLUT. If those files are present but in some other directory, you will need to tell libtool or the linker where to look to find them.

It could be that your original project had the development files in a non-standard location and copy-pasting just the code does not bring across all the build rules. If the files are installed in the standard locations, the tools should automatically find them even for new projects.

--smw

Stephen M. Webb
Professional Free Software Developer

if the glutlibrary directory is something different from /usr/lib (r.g. /usr/lib/glut/)
then you have to specify the librarypath by using -L/usr/lib/glutandwhatnot
- linker

Same goes for the headers. There it is -I/usr/include/glutandstuff
-compiler

The link the library you have to use -lglut or something similary (lib is -l, the rest is what you need to type)
Libarary files are always named libxxx.so.versionnumbers.more.andmore (shared libs)
or libxxx.a (static libs)
- linker

To compile and link a simple example "$ gcc -o test test.c -L/usr/lib/glut -I/usr/include/glut -lglut" should work.
- this links and compiles in one step


$ gcc -c -o test.o test.c -I/usr/include/glut - compile
$ gcc -o test test.o -L/usr/lib/glut -lglut - link

(if you compile and link in separation)

hope this helps
Quote: Original post by hydroo
if the glutlibrary directory is something different from /usr/lib (r.g. /usr/lib/glut/)
then you have to specify the librarypath by using -L/usr/lib/glutandwhatnot
- linker

Same goes for the headers. There it is -I/usr/include/glutandstuff
-compiler
I highly doubt it. I've never used a distro that puts development libraries and headers in non-standard locations, the package manager should handle setup enough that it "just works" to #include <GL/glut.h> and link with -lglut.

This topic is closed to new replies.

Advertisement