how to compile and link C with Mesa on Linux?

Hello, I am a beginner in OpenGL.
I am not quite sure how to compile and link C programs with Mesa, on Linux.

If you could give me some help, I would be very grateful.

Thanks in advance.

Doesn’t the MESA documentation say what you need to
do? Did you read any of the documentation?

Once you have MESA installed and all libraries are
in place (and you have rerun ldconf or rebooted
since installation), you should be able to compile
by simply: ‘gcc -c program.c’ or compile and link
with ‘gcc program.c -lGL’ and if you are using
any functions needing GLU then add “-lGLU”
to the above.
In some cases, and when you have not done things
correctly, you just might need to specify the path
to the libGL, etc, by adding “-L/usr/X11R6/lib” but
if that is the case, you are having other problems
too…

And do not forget to #include <GL/gl.h> and glx.h
if you need to.

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