Errors on Compiling my first program on OpenGL on Ubuntu I am trying to run the following program on ubuntu 15.04. However on typing "g++ pgm1.cpp -lglut"
I am getting following errors

/usr/bin/ld: /tmp/cc9aXqhZ.o: undefined reference to symbol 'glClear'

/usr/lib/x86_64-linux-gnu/mesa/libGL.so.1: error adding symbols: DSO missing from command line

Though I am familiar with C programming in Codeblocks and DevC++, this is the first time I am working on Ubuntu and OpenGL. I installed ubuntu and files related to OpenGL based on information available on the net. The sample program too is from the internet. I would request help in getting the program run. Thanks.

# include "GL/freeglut.h"
# include "GL/gl.h"
# include &lt;GL/glut.h&gt;

void init(void)
{
glClearColor(0.0f,0.0f,1.0f,1.0f);
}
void display (void) 
{
glClear(GL_COLOR_BUFFER_BIT);
glFlush();
}
int main (int argc, char** argv)
{
glutInit(&amp;argc,argv);
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
glutCreateWindow("A Blank Window");
init();
glutDisplayFunc(display);
glutMainLoop();
return 0;
}
You need to link with the OpenGL library. Try adding -lgl to the compilation command.