I have problems using standard functions like floor() and ceil() with gcc.
For example, I get: /tmp/ccMNi7Hj.o: In function `main':floor.c
.text+0x21): undefined reference to `floor'
collect2: ld returned 1 exit status
when trying to build this:
Code:
#include <stdio.h>
#include <math.h>
int main(void)
{
double d = 12.3;
d = floor(d);
printf("%f\n", d);
return 0;
}
However, this works fine:
Code:
#include <stdio.h>
#include <math.h>
int main(void)
{
printf("%f\n", floor(12.3));
return 0;
}
But I have no problems with any of this when using Dev-C++ under Windows XP. Does something have to be done differently with gcc under Linux or do I have a bad configuration/libraries?