compiling my first openGL program

Hi,
I was going to try some examples in the ‘red
book,’ but I can’t seem to get the compiler to work. The file looks like this:

#include <GL/glx.h>
#include <GL/gl.h>
#include <stdio.h>

int main(int argc, char **argv) {

GLshort myShort;

printf("GL_VERSION_1_2 = %d
",GL_VERSION_1_2);

glFlush();
}

I’m getting linking errors.
the compiler (gcc on a Sun) seems to be OK with my using GLShort and with referencing constants that are defined in the gl.h file, but I get linker errors whenever I try to use an OpenGL command, like glFlush(). I looked in the .h file,and I can see the prototype for glFlush, but it’s like it can’t find the object code. Here is the error message:

gcc openGl.c
Undefined first referenced
symbol in file
glFlush /var/tmp/ccpnBD1b.o
ld: fatal: Symbol referencing errors. No output written to a.out
collect2: ld returned 1 exit status

Compilation exited abnormally with code 1 at Tue Jul 11 12:30:35

I’m sorry that looks like a total mess.

Has anyone tried compiling on a Sun? Are there any gcc flags I need to set?

Any help would be appreciated.

Thank you,

Chris Fisichella

-lGL -lGLU ?