Search code examples
c++visual-c++neural-networkencog

Encog-c compile errors using vs2015 community


I've downloaded the encog-c souce from http://www.heatonresearch.com/encog/ and trying to compile them as instructed using vs2015 community.

When I build the solution I get the following errors:

    Severity    Code    Description Project File    Line    Suppression State

    Error   C2059   syntax error: 'sizeof'  encog-core  C:\Users\ypx7647\Documents\Visual Studio 2015\Projects\encog-c-master\encog-core\util.c 39  

    Error   C2059   syntax error: 'sizeof'  encog-core  C:\Users\ypx7647\Documents\Visual Studio 2015\Projects\encog-c-master\encog-core\util.c 44  

and this linker problem:

    Severity    Code    Description Project File    Line    Suppression State

    Error   LNK1181 cannot open input file 'C:\Users\ypx7647\Documents\Visual     Studio 2015\Projects\encog-c-master\Release\encog-core.lib'   encog-cmd   C:\Users\ypx7647\Documents\Visual Studio 2015\Projects\encog-c-master\encog-cmd\LINK    1   

I don't sunderstand the error in the code (here's the code):

#ifdef _MSC_VER
int isnan(double x) 
{ 
    return x != x; 
}

int isinf(double x) 
{ 
    return !isnan(x) && isnan(x - x);     
}
#endif

For the linker error, I cannot find the encog-c-core.lib file so can't add it to the additional linker directories.

What am I doing wrong? What else needs setting up in the enviroment in order to compile the source.

Thanks in advance for any help.


Solution

  • According to MSDN documentation

    since visual studio 2015, both functions are defined in the library. So, the workaround in util.c is not needed. Remove or comment out these definitions in util.c

    /*
    #ifdef _MSC_VER
    int isnan(double x) 
    { 
        return x != x; 
    }
    
    int isinf(double x) 
    { 
        return !isnan(x) && isnan(x - x);     
    }
    #endif
    */
    

    then recompile again. Hope this help.