cant make a file

i need help i cant make a file
this is d error they show
please help me i am new to linux and opengl
TexCoord2f’
/tmp/cclc6g9p.o:main.cpp:function drawScene(): error: undefined reference to ‘glTexCoord2f’
/tmp/cclc6g9p.o:main.cpp:function drawScene(): error: undefined reference to ‘glEnd’
/tmp/cclc6g9p.o:main.cpp:function drawScene(): error: undefined reference to ‘glDisable’
collect2: ld returned 1 exit status
make: *** [cube] Error

Add -lGL to the link line. For instance:


g++ -o tst tst.C -lGL

Depending on what your program uses, you may also want -lglut -lGLU -lGL.

If you still get some undefined gl* symbols, you may very well just need to install the OpenGL drivers for your GPU. Post back if you have more problems.

i did install everything required for opengl
using ths three commands

  1. sudo apt-get update
  2. sudo apt-get install build-essential
  3. sudo apt-get install freeglut3-dev

my error
samsung@ubuntu:~/Desktop$ g++ -o tst test.c -lGL
/tmp/ccPP3dla.o:test.c:function display(): error: undefined reference to ‘glutSwapBuffers’
/tmp/ccPP3dla.o:test.c:function key(unsigned char, int, int): error: undefined reference to ‘glutPostRedisplay’
/tmp/ccPP3dla.o:test.c:function idle(): error: undefined reference to ‘glutPostRedisplay’
/tmp/ccPP3dla.o:test.c:function main: error: undefined reference to ‘glutInit’
/tmp/ccPP3dla.o:test.c:function main: error: undefined reference to 'glutInitWindowSize

Now try g++ -o tst test.c -lGL -lglut