Error

I am a student studying OPENGL now.
However, I really do not understand what is going on.
I use c program in the Linux 8.1
The code I type below:

#include <GL/gl.h>

main()
{
glClear();
}

when I compliy, the error message show below:

[] gcc prog1.c /temp/ccdyk0ia.o: In function 'main' : /temp/ccdyk0ia.o(.text+0x7): undefined reference to 'glClear' collect 2: ld returned 1 exit status []

Originally posted by leo0801:
I am a student studying OPENGL now.
However, I really do not understand what is going on.
I use c program in the Linux 8.1
The code I type below:

Try gcc prog1.c -o prog1 -lGL <-- this links your program to libGL.so

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