使用vs2015社区进行Encog-c编译错误

时间:2016-09-18 15:49:19

标签: c++ visual-c++ neural-network encog

我已经从http://www.heatonresearch.com/encog/下载了encog-c源,并尝试按照vs2015社区的指示编译它们。

当我构建解决方案时,我收到以下错误:

    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  

和这个链接器问题:

    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   

我不会理解代码中的错误(这里是代码):

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

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

对于链接器错误,我找不到encog-c-core.lib文件,因此无法将其添加到其他链接器目录。

我做错了什么?在环境中需要设置什么才能编译源代码。

提前感谢您的帮助。

1 个答案:

答案 0 :(得分:1)

根据MSDN文档

自visual studio 2015以来,这两个功能都在库中定义。因此,不需要util.c中的变通方法。在util.c

中删除或注释掉这些定义
/*
#ifdef _MSC_VER
int isnan(double x) 
{ 
    return x != x; 
}

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

然后重新编译。希望这有帮助。