Compiling a C program that uses OpenGl in Mac OS X

In MacOS X you’re not using libraries to include system level APIs, but Frameworks. The proper command line to compile this program would be

gcc -Wall -ansi -pedantic -O2 \
    main.o graphic.o imagem.o io.o \
    -o ep2 \
    -framework OpenGL -lGLU -lglut

Note that GLU is probably part of the OpenGL framework as well. And it may be required to install GLUT first.

Leave a Comment