I wrote a program to test my understanding of fmod:
Qt Code:
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. int main(void) {
  5. double a = 259192.42201;
  6. double b = 24.10501259;
  7. printf("%11.10f", fmod(a,b));
  8. }
To copy to clipboard, switch view to plain text mode 
but I get the error:
samjnaa@linux:~/bin/learning> gcc fmod.c -o fmod
/tmp/ccK9XIYg.o: In function `main':
fmod.c.text+0x49): undefined reference to `fmod'
collect2: ld returned 1 exit status
and sure enough /usr/include/math.h has no reference to fmod -- what is this, GCC libraries are useless? Then how do I implement a modulus function? My GCC version is 4.0.2_20050901-3 and I have cpp, libgcc of same version, glibc 2.3.5-40 etc. Please help. Thanks.