Q:

Error when linking OpenGL program

I'm new to OpenGL programming. I installed Ubuntu 64bit OS and installed all required libraries. But today when compiling I got stuck with an error for which I'm unable to find a solution 
When I compiled my program with this command:
cc aa.c -lglut  -lGLU -lGL

the following error appeared
/urs/bin/ld: /tmp/ccCVosZx.o: undefined refrence to symbol 'cos@@GLIBC_2.2.5' //lib/x86_64-linux-gnu/libm.so.6: error adding symbols: DSO missing from command line

A:

Looks like you need to link to the math library explicitly with -lm.

