源文件:
代码: 全选
#include<stdio.h>
#include<math.h>
int main()
{
double x,s;
printf("input number:\n");
scanf("%lf",&x);
s=sin(x);
printf("sine of %lf is %lf\n",x,s);
return 0;
}
代码: 全选
gcc test2.c -o test2
/tmp/cc5DZBgn.o: In function `main':
test2.c:(.text+0x37): undefined reference to `sin'
collect2: ld 返回 1
代码: 全选
gcc test2.c -o test2 -lm