Quote:
Originally Posted by xueyou2
I built a program which report "sqrt" is not defined.
I look up the math.h file,there is not sqrt function.
So is the tcc different from gcc in function?
Can i replace the header file in tcc with the same file in gcc?
What is difference between tcc and gcc in function?
|
To link the math library, use:
tccmake myprog -lm
PHP Code:
]# cat hello.c
#include <stdio.h>
#include <math.h>
int main(void) {
float x=144;
printf("x=%f, sqrt(x)=%f\n",x,sqrt(x));
return 0;
}
]# tccmake hello -lm
]# ./hello
x=144.000000, sqrt(x)=12.000000
]#
It worked for me. You just did not link in the math library with the "-lm" parameter like I showed above...