## Recommended Posts

Saughmraat    140
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

##### Share on other sites
Valderman    513
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.

##### Share on other sites
Bregma    9214
Quote:
 Original post by ValdermanDo 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

##### Share on other sites
hydroo    295
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

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)

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