I have one file foo.c
:
#include <math.h>
int main(void) {
double x = 0.5;
double y = floor(x);
return 0;
}
I am trying to compile it with the following command:
$ gcc -lm foo.c
/tmp/cc9xiNp2.o: In function `main':
foo.c:(.text+0x24): undefined reference to `floor'
collect2: error: ld returned 1 exit status
The operating system I am using says:
$ cat /etc/debian_version
jessie/sid
$ gcc --version
gcc (Ubuntu 4.8.4-2ubuntu1~14.04.1) 4.8.4
Including -lm
always worked for me before. I'm not sure how to diagnose the problem?