简体   繁体   English

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

[英]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. 我已经从http://www.heatonresearch.com/encog/下载了encog-c源,并尝试使用vs2015社区按照说明进行编译。

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

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. 在此先感谢您的帮助。

According to MSDN documentation 根据MSDN文档

since visual studio 2015, both functions are defined in the library. 从Visual Studio 2015开始,这两个功能都在库中定义。 So, the workaround in util.c is not needed. 因此,不需要util.c的解决方法。 Remove or comment out these definitions in 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
*/

then recompile again. 然后重新编译。 Hope this help. 希望能有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM