View Full Version : how to compile and link C with Mesa on Linux?
11-07-2004, 05:50 AM
Hi, 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.
Well first of all you need mesa. In case you don't already have it, go to www.mesa3d.org (http://www.mesa3d.org) www.mesa3d.org (http://www.mesa3d.org) and download the latest distribution. In the readme files the instructions should be trivial to follow and install mesa on your system.
From then on, try to create a simple OpenGL (maybe + GLUT) program so not much could go wrong when you compile.
If you get function undefined errors gcc can't find the headers (remember to put capitals in #include <GL/glut.h>.
If you get linker errors (which is the more probable) you need to specify the library to link. In the simplest of cases this should be:
gcc -o glprogram glprogram.c -lglutNotice the -l it tells the linker to add this library. In case you're not lucky you need to add the path to the library as well:
gcc -o glprogram glprogram.c -lglut -L/usr/..etcCheck to see where mesa installs the libraries.
Hope the above helps. Post again if you need further help.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.