我正在使用C语言使用IAR Embedded Workbench。声明不兼容
我在将项目划分为通常的main/.h/.c格式时遇到了一些麻烦。
例如,如果我创建一个example.h文件
#ifndef EXAMPLE_H
#define EXAMPLE_H
void function(int [], int);
#endif
而不是example.c
#include "example.h"
void function (int[] array, int number)
{number = 1; //code
}
它说:
Error[Pe147]: declaration is incompatible with "__interwork __softfp
void function(int *, int)" (declared at line 4 of (path)
Error[Pe141]: unnamed prototyped parameters not allowed when body is present (path)
Error[Pe020]: identifier "number" is undefined (path)
Error while running C/C++ Compiler
'int [] array' ???这是C,而不是Java!另外,你说你正在使用“通常的.h/.c格式”,那么你在C文件中的哪个位置包含相应的H文件? –
当然不是。但这不是告诉它的方式。冷静下来。对于c文件,看看。 – EagleOne
在'example.h'中你不需要使用'#ifndef EXAMPLE_H',只要你喜欢,你可以多次声明一个函数原型,只要它们都是一样的。 –