c - 错误 98 :Conflict with previous definition of x for attribute 'type'

标签 c struct 8051 sdcc

我在使用 SDCC 和对旧 8051 进行编程时遇到此编译错误。 我正在尝试使 1wire 搜索命令工作。我得到了一个 OneWire 库,我开始为我的硬件/软件修改它,现在我陷入了这个错误:

C:\sdcc\code>sdcc test3.c
test3.c:164: error 98: conflict with previous definition of 'OW_search' for  attribute 'type'
from type 'int function ( struct OW_info generic* fixed, unsigned-char fixed) fixed'
to type 'int function ( struct OW_info generic* fixed, unsigned-char fixed) fixed'

出现错误的行如下。

183:...
184:int OW_search(struct OW_info *info)
185:{
186:unsigned char *buffer;
187:int id_bit_number;
188 ...

为了以防万一,OW_info的声明

struct OW_info
{
unsigned char family;
unsigned char serialNum[6];
unsigned char crc;

};

我正在对上面的函数进行原型(prototype)设计

int OW_search(struct OW_info *info);

我找不到导致编译错误的正确原因。我希望得到一些提示,为什么它会出现在那里。谢谢。

还有一个下载我的全部代码的链接http://www.upload.ee/files/4489287/test3.txt.html

最佳答案

我收到错误是因为我在对函数进行原型(prototype)设计后声明了结构。 感谢@TripeHound,现在知道必须在制作函数原型(prototype)之前声明结构,经过进一步研究,似乎没有其他方法。

关于c - 错误 98 :Conflict with previous definition of x for attribute 'type' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28189555/

相关文章:

c++ - 总的通用指针类型是什么?

c# - StructLayoutAttribute 对 C# 中的属性有什么影响?

c# - 存储在 c# 列表中的嵌套结构或类

8051的C编程 : SFR directions as arguments

c - 如何读取SPI总线上连接的ROM的第0地址?

microcontroller - 8051微 Controller 套件推荐?

c - 如何在c中不使用全局变量

C Linux ioctl TCGETS 和 TCSETS errno 25

c - 当线程因某些错误而终止时如何得到通知

c++ - POD 结构(相同类型的成员): are members in contiguous memory locations?