Here is a minimal example outlining my problem

test.c:

#include <stdio.h>
#include <math.h>

main ()
{
   fmod ( 3, 2 );
}

And here is the command I am issuing to compile test.c

gcc -lm test.c -o test

And here is the output I get when I issue the above command

/tmp/ccQmRk99.o: In function `main':
test.c:(.text+0x3e): undefined reference to `fmod'
collect2: ld returned 1 exit status

I get the same output if instead I use cc. I am using the following version of gcc

gcc-4.6.real (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1

Any ideas why my program won't compile?

Edit
Report