【问题标题】:Encog-c compile errors using vs2015 community使用vs2015社区encog-c编译错误
【发布时间】:2017-01-26 08:09:09
【问题描述】:

我从 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 文件,因此无法将其添加到其他链接器目录。

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

提前感谢您的帮助。

【问题讨论】:

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


【解决方案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
*/

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-27
    • 1970-01-01
    相关资源
    最近更新 更多