Thread: Why doesn't my gcc recognize math.h in subroutines?
hello of you.
trying develop little calculus application , gcc giving me problems math.h.
if try compile this:
i find no problems. if write down this:#include <stdio.h>
#include <math.h>
int main(void) {
printf("\n exp(1)=%lf", exp(1.0));
}
it doesn't work, giving error " undefined reference 'exp' ".#include <stdio.h>
#include <math.h>
double result(double x);
int main(void) {
printf("\n exp(1)=%lf", result(1.0));
}
double result(double x) {
return exp(x);
}
maybe noob mistake, wonder why happens.
i found link. hope it's of use mate:
http://www.linuxforums.org/forum/lin...math-h-lm.html
edit: in fact try putting 1.0 in exp function rather passing in x variable quick test. post #7 looks quite informative.
Forum The Ubuntu Forum Community Ubuntu Official Flavours Support General Help [ubuntu] Why doesn't my gcc recognize math.h in subroutines?
Ubuntu
Comments
Post a Comment