请帮看下这个程序哪里错了 拜托了 实在看不出来

我的是一个求积分的(用矩形面积)

#include<stdio.h>
#include<math.h>
int main()
{float integral(float(*)(float),float,float,int );
 float fsin(float);
 float a1,b1,c,(*p)(float);
 int n=20;
 printf("input a1 and b1:");
 scanf("%f%f",&a1,&b1);
 p=fsin;
 c=integral(p,a1,b1,n);
 printf("%lf\n",c);
 return 0;
}
float integral(float(*p)(float),float a,float b,int n)
{int i;
 double s,value,x=0,l;
 l=(b-a)/n;
 for(i=1;i<=n;i++)
   x+=(*p)(a+i*l-l/2);
 s=x*(b-a);
 return(s);
}

float fsin(float x)
{return sin(x);}

出现了错误:

/tmp/ccOQLJgy.o:在函数‘fsin’中:
e13.c:(.text+0x17f):对‘sin’未定义的引用
collect2: error: ld returned 1 exit status

能帮帮我吗 实在不明白了(明明引用了math.h 还说我sin没定义 好奇怪)

谢谢

Labermax
浏览 1480回答 2
2回答

慕丝2543519

写个注释呗
打开App,查看更多内容
随时随地看视频慕课网APP