作者Storm (风)
看板Linux
标题Re: 问题:不明函式finite()
时间Wed Jun 11 10:35:39 2008
※ 引述《[email protected] (旧的关系开始一一切断)》之铭言:
: 最近编译一只程式时,遇到finite()函式未定义的错误讯息。
: 然後就开始寻找finite()就近是属於哪个函式库的。
: 结果就是找不到,看起来像是C++的某个函式。
: 但是Google找不到,翻开C++数学函式没有这个,
: GSL也没有,libstdc++手册都没有。
: 所以只好上来向大家求助了。希望大家告诉
: 我它来自什麽函式库的名称就可以了,谢谢。
你这样的描述太过馍糊了,一般来说,要先去看看 source code 里面有引用了
哪些 header file,看看 Makefile 里面有引用了哪些 library,然後才能确定
finite() 到底是哪个 library 的函式。
不过基本上,用 man 查一下不就有了?你的系统的 manpage 不完整吗?
节录以下 finite(3) 的 manpage:
<quote>
FINITE(3) Linux Programmer's Manual FINITE(3)
NAME
finite, finitef, finitel, isinf, isinff, isinfl, isnan, isnanf, isnanl
- BSD floating point classification functions
SYNOPSIS
#define _BSD_SOURCE
#include <math.h>
int finite(double x);
[中略]
DESCRIPTION
The finite() functions return a non-zero value if x is neither infinite
nor a "not-a-number" (NaN) value, and 0 otherwise.
[中略]
NOTES
Note that these functions are obsolete. C99 defines macros isfinite(),
isinf() and isnan() (for all types) replacing them. Further note that
the C99 isinf() has weaker guarantees on the return value. See fpclas-
sify(3).
On a glibc system, these functions are declared by <math.h> when
_BSD_SOURCE or _SVID_SOURCE or _GNU_SOURCE is defined. The isnan()
functions will also be declared when _XOPEN_SOURCE is defined.
[後略]
</quote>
请注意变色的部分。
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 70.155.125.254