View Full Version : OpenGL/GLUT programming - gl.h and glu.h file locating
01-21-2004, 12:11 PM
I'm trying to set up my Linux (RedHat9.0) box so I can program some OpenGL on it, using cc and/or gcc. But I have errors that the compilers can find the gl.h and glu.h files that are to be included.
I found the most help so far in the "OpenGL library installation" thread, which someone was nice enough to tell me how to find the gl.h file with a find '/usr -name gl.h' which found it in '/usr/share/doc/NVIDIA_GLX-1.0/include/GL/gl.h'
First, is this the right place to find this file? Second, I couldn't locate glu.h, where can I get this? And why in the hell is this so hard to find/setup??
Help would be appreciated, and I'm really hoping I'm not the only one with this confusion.
01-21-2004, 12:37 PM
The gl headers are in /usr/include/GL, -I is your friend.
This document describes where header files should go:
This ABI specification is a critical document for Linux OpenGL developers. Refer to it and spread the word. Most of the questions around here seem to relate to it.
It's not hard, it's easy, but getting your hands on the right documentation helps.
01-21-2004, 01:11 PM
the gl headers weren't in that folder though. I was able to find gl.h in my NVIDIA driver installation, but not glu.h. glu.h is no where on my computer, which is my problem. I don't know where to get it from, as I haven't found one link anywhere to the file or a package/distrobution of some sort that includes it. Thanks for the help, all of this is getting pretty frustrating.
01-21-2004, 08:33 PM
OK, you should get your glu libs and header files from here, it's probably not a bad place for a standard gl.h also:
Instead of using a proprietary .h file get the standard extension header file from here:
Include that in addition to the standard .h to expose your extensions (and mainly to enummerate tokens). The getprocaddress or extension string checking will let you do runtime checking of functions than may not be available. It should be inclusive anyway with the added advantage that it'll work on a number of cards & drivers to expose all the registered extensions.
Maybe gl.h and glu.h should also be in the SDK page although I think there's the assumption that they're easier to come by and are best shipped with defs contemporaneous with your drivers and their supported gl version. So maybe the nv gl.h is the right thing if it's created correctly and maybe you could also include the glext.h, that's how it should work in theory.
Finally place all the header files in /usr/include/GL/ then you'll be ABI compliant when building your project and it should be futureproof in addition to being compatible with correctly configured development environments.
Hmm, seems like there's an FAQ needed on this item. "Creating a Kosher Linux OpenGL SDK". Something tells me it should be easier than this.
The distro builder should really be doing this (and the drivers/SDKs from the card makers and other package builders playing nicely with the distros).
[This message has been edited by dorbie (edited 01-21-2004).]
You could always try download the mesa3d lib, but i would try to find the files using:
find / | grep gl.h
And, don't put the files in /usr/include/GL
they shall be in /usr/X11R6/include/GL
This is for the linux filesystem layout
01-22-2004, 09:41 AM
If you're using RedHat then there must be RPMs sitting on your distro CD.
No distro worth its weight would not include something like this.
01-22-2004, 12:56 PM
So, I've found the file I need, but am now having compile errors due to library bizzareness.
here's the command and output crap:
cc -g teapot.c -lglut -lGLU -lGL -lXmu -LXext -lX11 -lm -o teapot
/usr/bin/ld: cannot fine -lXmu
collect2: ld returned 1 exit status
make: *** [teapot] Error 1
I have checked and my /etc/ld.so.conf has /usr/x11R6/lib in it, and the libXmu files are in that folder, so anyone know what gives? man, what a headache this all is.
Thanks guys for all the help so far!
PS:i have to use cc, part of the parameters that were required for this project
01-22-2004, 02:07 PM
How about using -L to add link dirs and watch the case sensitivity in the library paths, this ain't windows.
P.S. you also have a -L instead of -l for Xext on the command line you posted.
[This message has been edited by dorbie (edited 01-22-2004).]
cc -g teapot.c -L/usr/X11R6/lib -lglut -lGLU -lGL -lXmu -LXext -lX11 -lm -o teapot
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.