简体   繁体   English

为什么我不能编译此C API(NeMo Spiking神经网络模拟器)

[英]Why can't I compile this C API (NeMo Spiking Neural Network Simulator)

Hi I am trying to utilize this library http://nemosim.sourceforge.net to play around with Spiking Neural Networks. 嗨,我正在尝试利用此库http://nemosim.sourceforge.net与Spiking Neural Networks一起玩耍。

I am new to C and C++. 我是C和C ++的新手。

What I've done is, downloaded the installer from here: http://sourceforge.net/projects/nemosim/ 我所做的是,从此处下载安装程序: http : //sourceforge.net/projects/nemosim/

Installed. 安装。

I then wrote this program in main.c file: 然后,我在main.c文件中编写了该程序:

#include<nemo.h>
#include<stdio.h>
#include<stdlib.h>

main()
{
    printf("Hello World!");
    getchar();      
}

and compiled it using MinGW on Windows: 并在Windows上使用MinGW对其进行了编译:

gcc -I"C:\Program Files (x86)\NeMo\include" main.c -o main.exe

I get the following error: 我收到以下错误:

In file included from main.c:1:0:
C:\Program Files (x86)\NeMo\include/nemo.h:48:1: error: unknown type name 'nemo_
network_class'
 typedef nemo_network_class* nemo_network_t;
 ^
C:\Program Files (x86)\NeMo\include/nemo.h:49:1: error: unknown type name 'nemo_
simulation_class'
 typedef nemo_simulation_class* nemo_simulation_t;
 ^
C:\Program Files (x86)\NeMo\include/nemo.h:50:1: error: unknown type name 'nemo_
configuration_class'
 typedef nemo_configuration_class* nemo_configuration_t;
 ^

Please help me. 请帮我。

It looks like nemo.h has problems, but I suspect I am missing something because I am a newbie... 看来nemo.h出现问题,但我怀疑我缺少一些东西,因为我是新手...

It looks like this code has a common error that occurs when C++ programmers migrate to writing C code. C ++程序员迁移到编写C代码时,似乎此代码有一个常见错误。 In C++, you can declare a struct nemo_network_class object by writing, for example: 在C ++中,可以通过编写声明一个struct nemo_network_class对象,例如:

nemo_network_class foo;

However, in C, the struct is part of the type identifier. 但是,在C中,该struct是类型标识符的一部分。 You must write: 您必须写:

struct nemo_network_class foo;

Change this: typedef nemo_network_class* nemo_network_t; 更改为: typedef nemo_network_class* nemo_network_t;

... to this: typedef struct nemo_network_class* nemo_network_t; ...为此: typedef struct nemo_network_class* nemo_network_t;

Change this: typedef nemo_simulation_class* nemo_simulation_t; 更改此内容: typedef nemo_simulation_class* nemo_simulation_t;

... to this: typedef struct nemo_simulation_class* nemo_simulation_t; ...为此: typedef struct nemo_simulation_class* nemo_simulation_t;

Change this: typedef nemo_configuration_class* nemo_configuration_t; 更改此内容: typedef nemo_configuration_class* nemo_configuration_t;

... to this: typedef struct nemo_configuration_class* nemo_configuration_t; ...为此: typedef struct nemo_configuration_class* nemo_configuration_t;


After you've made these changes and confirmed that they work, please submit a bug report so that this solution gets pushed into production. 在进行了这些更改并确认它们可以正常工作后,请提交错误报告,以便将该解决方案投入生产。

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

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