LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 806|回复: 1

这个问题怎么解决?在线等

[复制链接]
发表于 2003-5-29 10:25:28 | 显示全部楼层 |阅读模式
一些数学算符通不过编译。下面是测试程序和出错结果:
#include <stdio.h>
#include <math.h>
void  main(){
        float a;
        a=cos(2);
}
[jonny@jonny paper]$ gcc cosine.c
cosine.c: In function `main':
cosine.c:3: warning: return type of `main' is not `int'
/tmp/ccl6oCIj.o(.text+0x1b): In function `main':
: undefined reference to `cos'
collect2: ld returned 1 exit status
发表于 2003-5-29 10:35:47 | 显示全部楼层
see FAQ!

gcc -lm -o cosine cosine.c
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表