'ifinite'未在此范围内声明

时间:2013-11-21 13:27:01

标签: c++ c compilation shogun

我正在尝试编译shogun工具箱,我遇到了这个错误

    C:/shogun-3.0.0/shogun-3.0.0/src/shogun/../shogun/mathematics/Math.h: In static
    member function 'static int shogun::CMath::is_finite(double)':
    C:/shogun-3.0.0/shogun-3.0.0/src/shogun/../shogun/mathematics/Math.h:1255:20: er
    ror: 'ifinite' was not declared in this scope
    return ifinite(f);

函数本身看起来像这样。

        inline static int is_finite(double)
        {      
        #if defined(isfinite) && !defined(SUNOS)
        return ifinite(f);
        #else
        return finite(f);
        #endif
        }

我相信这里描述的类似:http://www.alecjacobson.com/weblog/?p=1768,但我不确定,因为我不包括cmath。知道它可以是什么吗?

2 个答案:

答案 0 :(得分:2)

功能为isfinite,而不是ifinite

您不包含<cmath>,但根据Shogun来源here,它确实包含错误顺序的<cmath><math.h>

#include <shogun/base/SGObject.h>
#include <shogun/lib/common.h>
#include <cmath>                             <<<<<<
#include <shogun/mathematics/Math.h>
#include <shogun/mathematics/lapack.h>
#include <shogun/io/SGIO.h>

#include <stdio.h>
#include <stdlib.h>
#include <math.h>                            <<<<<<

所以你应该使用std::isfinite

答案 1 :(得分:2)

我刚刚从here下载了shogun-3.0.0,并且源中的任何地方都没有出现字符串“ifinite”。 is_finiteMath.h的定义是:

        /// checks whether a float is finite
        inline static int is_finite(double f)
        {
#if defined(isfinite) && !defined(SUNOS)
            return isfinite(f);
#else
            return finite(f);
#endif
        }

如果您输入问题的错误和源文本是正确的,那么您的来源可能已损坏。您应该下载源代码并重试。