LinuxSir.cn,穿越时空的Linuxsir!

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

无法调用math.h中的函数

[复制链接]
发表于 2004-5-5 11:26:48 | 显示全部楼层 |阅读模式
[elais@localhost acm]$ gcc -o temp ./temp.c
/tmp/ccGnmOMI.o(.text+0x28): In function `main':
: undefined reference to `log'
collect2: ld returned 1 exit status


ps:我已经在程序中加了#include<math.h>
发表于 2004-5-5 11:35:17 | 显示全部楼层
key "log"有错误,称序贴出来看看哟
 楼主| 发表于 2004-5-5 11:51:54 | 显示全部楼层

..

#include<stdio.h>
#include<math.h>
int main()
{
  double a=1;
  double result;
  result=log(a);
   
  printf("result=%f\n",result);
  return 0;
}
发表于 2004-5-5 11:55:38 | 显示全部楼层
你在头文件定义了log()了吗?
 楼主| 发表于 2004-5-5 11:55:51 | 显示全部楼层

知道解决方法了

加个lm
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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