How should i compile?

I’m having major problems trying to compile an OpenGL program in Linux using gcc .
my command line is …
gcc -o myprog file.c -lGL -lGLU -lglut -I/usr/X11R6/include -L/usr/X11R6/lib
but the thingie doesnt compile. Just gives me a LOT of undefined references from all those libraries (libGL.so, libglut.so, libGLU.so) undefined references to a hell lotta X<functions> . Someone PLEASE help me out

Hi,

Have you checked that you have all the *.h and *.so files in your system and in path.

Best way is to get some examples with makefile. Maybe nehe.gamedev.net there are some tutorials convertedto linux also.

try compile those tutorials, if I remember right some of those need math library been added in makefiles in some distro, but they should compile ok.

if you can compile some tutorial, check what is included in makefile and make your own using that makefile as reference.

Originally posted by Alius:
I’m having major problems trying to compile an OpenGL program in Linux using gcc .
my command line is …
gcc -o myprog file.c -lGL -lGLU -lglut -I/usr/X11R6/include -L/usr/X11R6/lib
but the thingie doesnt compile. Just gives me a LOT of undefined references from all those libraries (libGL.so, libglut.so, libGLU.so) undefined references to a hell lotta X<functions> . Someone PLEASE help me out

I just have to do
gcc -o myprog file.c -lGL -lGLU -lglut
to compile. The GL headers are in /usr/include/GL/ and the libraries are in /usr/lib but perhaps is this depending on the distribution?

You should check that the libraries really exist and in case of symlinks that they are correct. Perhaps do you need to do a ldconfig?

GOTCHA !
thanx guyz, but anyway had to find ze correct answer to moi problemo. A friend did it what compiles -
gcc file.c -lglut -lGL -lGLU -L/usr/X11R6/lib -lXaw -lXi -lm -o myprog
whew
that about does it thanx anywayz…

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