我正在创建一个Arduino库,它为我的个人项目提供了两个构造函数,但由于某种原因,我不断收到一个类型特定的错误,首先让我告诉你结构如何。所以这里是我的文件:C++测试库时出错
这是头文件:
#ifndef iGA_H
#define iGA_H
class iGA {
public:
getParameters(int soundA[], int soundB[], int parentId[]);
private:
int _soundA[];
int _soundB[];
int _parentId[];
}
cpp文件:
#include <iGA.h>
iGA::getParameters(int soundA[], int soundB[], int parentId[])
{
_soundA = soundA;
_soundB = soundB;
_parentId = parentId;
}
这该是多么IM几乎调用草图中的构造,内设置()函数:
#include <iGA>
iGA iga;
void setup() {
iga.getParameters(r, r1 , r2);
}
,这里是错误:
In file included from /home/bargros/Dropbox/iGA__NewBild/iGA__NewBild.ino:34:0:/home/bargros/Arduino/libraries/iGA/iGA.h:10:58: error: ISO C++ forbids declaration of 'getParameters' with no type [-fpermissive]getParameters(int soundA[], int soundB[], int parentId[]);
我知道错误有事情做与参数类型或者也许我调用构造函数错误,但我也打过电话这样的:
iGA iga = getParameters(etc,etc,etc);
即时通讯相对较新的C++和IM有点无能至于这个错误告诉我什么。有没有人有任何想法,为什么发生这种情况?
你的getParameters应该返回一些东西。**提示**:**之前应该有东西** iGA :: getParameters – Incomputable
'getParameters(int soundA [],int soundB [],int parentId []);'至少应该是'void getParameters(int soundA [],int soundB [],int parentId []);'。 –
试图添加无效,仍然得到相同的错误 - 将尝试@FirstStep建议。 – Bargros