Warm tip: This article is reproduced from serverfault.com, please click

c-声明不兼容

(c - Declaration is incompatible)

发布于 2015-10-13 19:57:40

我当时使用C语言与IAR Embedded Workbench一起工作。

在将项目划分为通常的main / .h / .c格式时遇到了一些麻烦。

例如,如果我创建一个example.h

#ifndef EXAMPLE_H
#define EXAMPLE_H
void function(int [], int);
#endif

而不是一个例子。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 
Questioner
EagleOne
Viewed
11
AnatolyS 2015-10-14 04:00:24

你使用了错误的语法。看着

void function (int array[], int number)
{  number = 1; //code
}