2

I'm trying to compile shogun toolbox and I'm getting this fault

    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);

function itself looks like this.

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

I believe similar is described here: http://www.alecjacobson.com/weblog/?p=1768, but I'm not sure as I don't include cmath. Any idea what it can be?

Alfe
  • 56,346
  • 20
  • 107
  • 159
Krzysztof Fajst
  • 151
  • 3
  • 14

2 Answers2

2

Function is isfinite, not ifinite.

You don't include <cmath> but according to Shogun source here, it does include both <cmath> and <math.h> in the wrong order:

#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>                            <<<<<<

So you are supposed to use std::isfinite.

Jack
  • 131,802
  • 30
  • 241
  • 343
2

I just downloaded shogun-3.0.0 from here, and there is no occurrence of the string “ifinite” anywhere in the source. The definition of is_finite in Math.h is:

        /// 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
        }

If the errors and source text you entered into the question are correct, perhaps the sources you have were corrupted. You should download the source and try again.

Eric Postpischil
  • 195,579
  • 13
  • 168
  • 312