fjleal
4th March 2004, 10:58 AM
Greetings!
I'm doing a simple C exercise on FC1 like this one:
#include <stdio.h>
#include <math.h>
int main(int argc, char *argv[]) {
double a=log(100.0);
printf("%f\n", a);
exit(0);
}
when I invoke gcc ("gcc -o test test.c") I get the following error:
"
/tmp/cckCz1r1.o(.text+0x20): In function `main':
: undefined reference to `log'
collect2: ld returned 1 exit status
"
The "log()" function is defined in <math.h>. If I do a "gcc -o test test.c -E" (just to invoke the preprocessor, not the compiler nor the linker) I can see the code for the log() function (the preprocessor seems to do its job well).
So what may be the problem? Is it something related to FC1?
Thanks a lot. ;)
I'm doing a simple C exercise on FC1 like this one:
#include <stdio.h>
#include <math.h>
int main(int argc, char *argv[]) {
double a=log(100.0);
printf("%f\n", a);
exit(0);
}
when I invoke gcc ("gcc -o test test.c") I get the following error:
"
/tmp/cckCz1r1.o(.text+0x20): In function `main':
: undefined reference to `log'
collect2: ld returned 1 exit status
"
The "log()" function is defined in <math.h>. If I do a "gcc -o test test.c -E" (just to invoke the preprocessor, not the compiler nor the linker) I can see the code for the log() function (the preprocessor seems to do its job well).
So what may be the problem? Is it something related to FC1?
Thanks a lot. ;)