未定义的引用`pow'和`floor'我正在尝试在C中制作一个简单的斐波那契计算器,但在编译时gcc告诉我,我错过了战俘和地板功能。怎么了?码:#include <stdio.h>#include <math.h>int fibo(int n);int main() {
printf("Fib(4) = %d", fibo(4));
return 0;}int fibo(int n) {
double phi = 1.61803399;
return (int)(floor((float)(pow(phi, n) / sqrt(5)) + .5f));}输出:gab@testvm:~/work/c/fibo$ gcc fib.c -o fibo/tmp/ccNSjm4q.o: In function `fibo':fib.c:(.text+0x4a): undefined reference to `pow'fib.c:(.text+0x68): undefined reference to `floor'collect2: ld returned 1 exit status
- 3 回答
- 0 关注
- 1254 浏览
添加回答
举报
0/150
提交
取消