OpenGL under Linux

It is wierd. I use the Linux8.0 which include the opengl gl.h and glu.h etc.but I can’t compile any code containing gl*.How do i do?( I already link the lib in my c source code)

Linux8.0

I think you mean Red Hat Linux 8.0 ?
Linux 8.0 doesn’t exist, it’s still at 2.4 and 2.5 currently
(soon 2.6)

( I already link the lib in my c source code)

I’m not sure if that’s possible using GCC.
Try linking with the libraries in your Makefile(.am/.in) (add -lGL and -lGLU)

…and -L/usr/X11R6/lib (or gcc won’t find the libraries)

Can anyone tell me why this is necessary under GNU/Linux, when all other OSes have the X11 lib path in the compiler lib path by default? (I realize this has nothing to do with the OS, but with the compiler configuration - but still, why?!)

Why?

Because Linux only recently became popular as a graphical environment. It was not unusual to have a box without X. The compiler should be agnostic about that.

If you have a problem with that nag the distribution packagers Or reconfigure your install.

[This message has been edited by FermatSpiral (edited 01-29-2003).]

The linux kernel and most linux programs were written in C. As you know C is case sensitive. You need to include do

#include <GL/glut.h> //glut
#include <GL/glu.h> //glu
#include <GL/gl.h> //ogl stuff

To compile with glut just use this command

g++ main.cpp -B /usr/X11R6/lib -o program -lX11 -lXi -lXmu -lglut -lGL -lGLU -lm -lpthread -Wno-deprecated

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.