View Single Post
Old 05-16-2012, 09:16 AM   #48
xueyou2
Connoisseur
xueyou2 can eat soup with a fork.xueyou2 can eat soup with a fork.xueyou2 can eat soup with a fork.xueyou2 can eat soup with a fork.xueyou2 can eat soup with a fork.xueyou2 can eat soup with a fork.xueyou2 can eat soup with a fork.xueyou2 can eat soup with a fork.xueyou2 can eat soup with a fork.xueyou2 can eat soup with a fork.xueyou2 can eat soup with a fork.
 
Posts: 58
Karma: 9096
Join Date: Apr 2012
Device: none
Quote:
Originally Posted by geekmaster View Post
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.000000sqrt(x)=12.000000
]
It worked for me. You just did not link in the math library with the "-lm" parameter like I showed above...



I just test hello on my kindle

/mnt/us/tcc #tccmake hello -lm
tcc:cannot find -lm
/mnt/us/tcc #tccmake hello
tcc:undefined synbol 'sqrt'

The problem is still there.
I just install tcc v1.5
the result is same.
xueyou2 is offline   Reply With Quote