Basic installation

A newbie question:

I have just installed redhat 7.1 on my desktop. And the GL dir is found in the /usr/include. But when i try to compile the sample program, the error message said "undefined reference on “glColor”
"undefined reference on “glVertex3f” …

What’s problem


Those sound like linker problems, in which case you aren’t linking properly. Something like the following:

gcc … -L/usr/X11R6/lib -lGL -lGLU -lglut -lX11

should do it (you don’t need the -lglut if you aren’t using glut, and -lX11 may not be necessary either). Replace … with your own stuff.

It works now! So it means I need to compile all file by such a “long” command: “gcc -o file file.c -L/usr/X11R6/lib -lGL -lGLU -lglut”?
Could i do some way shorter?


Use a Makefile.

Hope this helps.

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