Unresolved text symbol "cos" ?

I’m trying to compile a simple 3d cube model from one of the tutorials but keep getting compiler error:

ld32:ERROR 33: Unresolved text symbol "cos" -- 1st referenced by /usr/freeware/lib32/libglut.a(glut_shapes.a).  

OS is IRIX 6.5 and compiler is GNU GCC.

you have to add the math library using the -lm flag:

gcc -o test test.c -lm