首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >未在此作用域中声明“‘ifinite”

未在此作用域中声明“‘ifinite”
EN

Stack Overflow用户
提问于 2013-11-21 21:27:01
回答 2查看 2.9K关注 0票数 2

我正在尝试编译幕府工具箱,我得到了这个错误

代码语言:javascript
复制
    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);

函数本身看起来像这样。

代码语言:javascript
复制
        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。你知道它会是什么吗?

EN

回答 2

Stack Overflow用户

发布于 2013-11-21 21:32:18

函数是isfinite,而不是ifinite

你没有包括<cmath>,但根据幕府来源here的说法,它确实以错误的顺序包括了<cmath><math.h>

代码语言:javascript
复制
#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

票数 2
EN

Stack Overflow用户

发布于 2013-11-21 23:20:16

我刚刚从here下载了幕府将军-3.0.0,在源代码中没有出现字符串“ifinite”。Math.his_finite的定义是:

代码语言:javascript
复制
        /// 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
        }

如果您在问题中输入的错误和源文本是正确的,则可能是您的源已损坏。您应该下载源代码,然后重试。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20122267

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档