Advertisement

OpenGL (nehe #1) / Linux problem (and a little SDL)...

Started by July 09, 2003 03:30 AM
11 comments, last by Illumini 21 years, 7 months ago
I''ve installed RH9 and messed around with gcc a little, I was able to compile simple programs so I decided to try and compile the first Nehe example. There were three ports to choose from so I decided on the Linux/SDL version. when I attempt to make the makefile... I get the follow errors (these are the first of many of course).

[root@localhost lesson01]# ls
lesson01.c  lesson01.c~  Makefile  README
[root@localhost lesson01]# make
gcc -Wall -ansi lesson01.c -o lesson01 -lGL -lGLU `sdl-config --cflags --libs`
/bin/sh: line 1: sdl-config: command not found
lesson01.c:15:19: GL/gl.h: No such file or directory
lesson01.c:16:20: GL/glu.h: No such file or directory
lesson01.c:17:17: SDL.h: No such file or directory
lesson01.c:29: parse error before ''*'' token
 
Now understandably it can''t find SDL or OpenGL headers. On the first note, I have installed the SDL rpm.. but to no avail. (I can''t seem to find where it is putting the headers/libs anyway.. Didn''t see anything sdl in usr/include or usr/lib). Secondly, I dont think the GL headers are installed (although they should have been, considering I checked about every development option I could when installing). I looked in usr/include/GL and these are the files I found.. fgl.h fglu.h fglut.h glsmaph glut.h I opened the f*.h files, but they are certianly not any type of c/c++ headers I''ve ever seen. Odd. Anyway I was wondering where I could find the real GL.h and glu.h (along with the libs I''d assume) for linux? Also anyhelp on the SDL problem would be apprieciated.
Firstly, iou need to install some sort of libsdl-dev package (it appears that it''d be called something like libSDL1.2-devel-something.rpm for Red Hat). It will include headers and the sdl-config helper script.

Secondly, you probably need to install another ''dev'' package for the OpenGL headers (the appropriate package is called "xlibmesa-gl-dev" in Debian, but I''m not sure exactly what Red Hat calls it anymore). The OpenGL headers should be placed in /usr/include/GL (and they may be symlinks to: ) or /usr/X11R6/include/GL. In response to the "along with the libs I''d assume": shared libraries are all you need to link with OpenGL in most *nix environments (that support shared libraries, of course), and they''re provided in the ''non-dev'' package (although static libraries are normally provided in the ''dev'' package, if you want to link that way, but you probably don''t).

By the way, I''m pretty sure those F prefixed headers are for Fortran.

Advertisement
I think I understand most of what you said. I have already run the following RPM''s (if I run them again they tell me they are already installed).

XFree86-Mesa-libGL-4.3.0-2.i386.rpm
XFree86-Mesa-libGLU-4.3.0-2.i386.rpm
SDL-1.2.5-1.i386.rpm
SDL-develop-1.2.5-1.i386.rpm

I had done all this before posting, however I still get the errors with gcc. Is it possible gcc is looking in the wrong place? Also I still can''t locate where the rpm''s were extracted too (I''m rather new to Linux), usr/include contains only GL/glut.h, and usr/x11R6/include contains basically nothing. Where else could the rpm''s installed too?

Thanks.
quote:
Original post by Illumini
XFree86-Mesa-libGL-4.3.0-2.i386.rpm
XFree86-Mesa-libGLU-4.3.0-2.i386.rpm

Those two need their ''dev'' counterparts to be installed for you to get the OpenGL headers.

quote:
Original post by Illumini
SDL-1.2.5-1.i386.rpm
SDL-develop-1.2.5-1.i386.rpm

That should be all you need for SDL. The SDL headers are placed in /usr/include/SDL normally. I don''t know why sdl-config isn''t included. These are all "official" Red Hat RPMs, right (just making sure)?

I have a Red Hat 9 CD or two sitting around, I''ll try looking for the correct RPMs and making sure they have the correct files included. Hopefully my CDROM drive is working (it hasn''t been working completely correctly for a while, so I''ll see in a moment)...

By the way, since I just noticed this part of your shell paste from above: Don''t compile things (or generally do anything) as root if at all possible. Less mistakes get made that way .

Since I couldn''t get my CDROM drive to work, I downloaded SDL-devel-1.2.5-3.i386.rpm, and checked it for all the files that you''d need. All of the headers as well as sdl-config are included in there.

Also, I noticed there were no direct ''dev'' counterparts to the Mesa packages, so I looked for what should fill that role. I found XFree86-devel-4.3.0-2.i386.rpm, downloaded it, and checked to see if it had the OpenGL headers. Sure enough, it has them in it.

That should be all you need.

You might need to tell gcc the path of were these things are. Its -B /usr/X11/lib I think Ill post my SDL make file when I get home from work.
Advertisement
Make sure you have mesa. Try running glxgears and look in /usr/include/GL for all your OGL headers. If you dont have mesa goto mesa3d.sf.net and get it.
Thanks guys, I''ll check into all that right away.
Still having some trouble...

I was logged in as root when i intsalled those rpm''s, could this have something to do with my problem?

I''ve run all the RPM''s suggested now and I still didn''t have the correct headers (gl.h/glu.h and sdl''s). Also where is sdl-config supposed to be located?
Thanks for all the help! I logged in as my username (not root), installed the sdl dev rpm, then everything compiled fine! I got neehe lesson 1 running, so I decided to push my luck and trya more advanced one. I chose lesson6, the textured box. It works fine, but for some reason the texture is not being displayed . I looked at the code and it seems te program should quit if the texture can''t be loaded.. So I''m not sure why its just a white cube. Any ideas guys?

This topic is closed to new replies.

Advertisement