本人刚刚开始用linux里面的gcc编译c语言程序就遇到了不能引用库函数的问题:
测试程序如下:
#include<stdio.h>
#include<math.h>
main()
{ float a;
a=sin(10);
printf("the result is %.4f",a);
}
[hexing@localhost cprogram]$gcc -o test test.c
/tmp/ccIZ32b0.o:In function `main':
/tmp/ccIZ32b0.o(text+0xae):undefined reference to `sin'
collect2:ld returned 1 exit status
[hexing@localhost cprogram]$