PDA

View Full Version : trouble to compile glut



truc_82
03-03-2004, 06:32 AM
Hi,
I'm a newcomer here. I have trouble to compile opengl on Linux.
I added the header file glut.h in /usr/include/GL already.
And when I try: gcc -lglut file.c
it gives this error :
/usr/bin/ld: cannot find -lglut
collect2: ld returned 1 exit status
I'm using Linux Redhat 9.0 to compile it.
Are there anyone who know this problem can help me. I appriciate about that.
Truc

Deiussum
03-03-2004, 10:39 AM
You need the library file as well. (Usually a .so or .a file in Linux). Just the header is not enough. You may have it already and just need to add a path to your library search paths with something like -L/usr/X11R6/lib.

truc_82
03-03-2004, 10:26 PM
Hi,
where can I find the library file (.a or .so)
and where should i add the path L/usr/X11R6/lib ?
Thanks alot

Deiussum
03-04-2004, 05:52 AM
If you're using RedHat, you can probably find an RPM for glut development, though you might want to read a post about glut under RedHat that was made sometime back as there were some issues with glut and RH 9.0, I believe. (Do a search on it)

The -L/usr/X11R6/lib goes on your command line to gcc like so:

gcc -lglut file.c -L/usr/X11R6/lib

That's assuming that you have the file libglut.so in /usr/X11R6/lib, which is one of the locations it is typically installed.

Also, you will likely be needing -lGL, -lGLU, and possibly some other libraries as well.

[This message has been edited by Deiussum (edited 03-04-2004).]