lgamma功能:ANSI C与否? [英] lgamma function: ANSI C or not?

查看:106
本文介绍了lgamma功能:ANSI C与否?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个.c源文件,顶部包含该行


#include< math.h>


在该源文件中,我声明了一个函数dt,它在其体内使用了

的lgamma函数。我的linux系统上的man lgamma告诉我

我必须包含math.h所以看起来我正在做

正确的事情才能能够使用lgamma函数。


当我编译.c文件时


$ gcc -ansi -c rand.c < br $>




$ gcc -Wall -c rand.c


然后我没有错误或警告。当我编译它时


$ gcc -Wall -ansi -c rand.c


我收到警告:


rand.c:在函数`dt'':

rand.c:544:警告:隐式声明函数`lgamma''


这对我来说很奇怪。为什么我收到此警告?我如何解决此警告?b $ b我认为它与ANSI C有关,

但我很困惑......


谢谢,

Bart


PS:我使用的gcc版本是gcc(GCC)3.3.5(Debian 1:3.3.5-13)。

升级到新版本是没有选择的,因为我没有管理员权限

来安装或升级我的系统上的软件包。


-

分享你所知道的。了解你不知道的事情。

I''m having a .c source file which at the top contains the line

#include <math.h>

In that source file, i declare a function dt which in its body uses
the lgamma function. `man lgamma'' on my linux system tells me
that i have to include math.h so it seems like I''m doing the
right thing in order to be able to use the lgamma function.

When I compile the .c file with

$ gcc -ansi -c rand.c

or

$ gcc -Wall -c rand.c

then I get no errors or warnings. When I compile it with

$ gcc -Wall -ansi -c rand.c

I get the warning:

rand.c: In function `dt'':
rand.c:544: warning: implicit declaration of function `lgamma''

which seems strange to me. Why am I getting this warning and how do I
resolve this warning? I assume it has something to do with ANSI C or not,
but I''m confused...

Thanks,
Bart

PS: the version of gcc I''m using is gcc (GCC) 3.3.5 (Debian 1:3.3.5-13).
Upgrading to a newer version is no option because I do not have admin rights
to install or upgrade packages on my system.

--
"Share what you know. Learn what you don''t."

推荐答案

gcc -ansi -c rand.c




gcc -ansi -c rand.c

or


gcc -Wall -c rand.c


然后我没有错误或警告。我编译时用

gcc -Wall -c rand.c

then I get no errors or warnings. When I compile it with


gcc -Wall -ansi -c rand.c


我收到警告:


rand.c:在函数`dt'':

rand.c:544:警告:隐式声明函数`lgamma''


这对我来说很奇怪。为什么我收到此警告?我如何解决此警告?b $ b我认为它与ANSI C有关,

但我很困惑......


谢谢,

Bart


PS:我使用的gcc版本是gcc(GCC)3.3.5(Debian 1:3.3.5-13)。

升级到新版本是没有选择的,因为我没有管理员权限

来安装或升级我的系统上的软件包。


-

分享你所知道的。了解你不知道的事情。
gcc -Wall -ansi -c rand.c

I get the warning:

rand.c: In function `dt'':
rand.c:544: warning: implicit declaration of function `lgamma''

which seems strange to me. Why am I getting this warning and how do I
resolve this warning? I assume it has something to do with ANSI C or not,
but I''m confused...

Thanks,
Bart

PS: the version of gcc I''m using is gcc (GCC) 3.3.5 (Debian 1:3.3.5-13).
Upgrading to a newer version is no option because I do not have admin rights
to install or upgrade packages on my system.

--
"Share what you know. Learn what you don''t."


这篇关于lgamma功能:ANSI C与否?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆