I am getting this compile error using SDCC and programming an old 8051. I am trying to make 1wire search command work. I got my hands on an OneWire library that I started modifying for my hardware/software and now I am stuck behind this error:
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'
The lines where the error come in are the following.
183:...
184:int OW_search(struct OW_info *info)
185:{
186:unsigned char *buffer;
187:int id_bit_number;
188 ...
Just in case, the declaration of OW_info
struct OW_info
{
unsigned char family;
unsigned char serialNum[6];
unsigned char crc;
};
I am prototyping the function above
int OW_search(struct OW_info *info);
I can not find a proper reason why I am getting that compile error. I am hoping for some hints why it would come there. Thanks.
And a link to download my entire code http://www.upload.ee/files/4489287/test3.txt.html
I got the errors because I declared the structures after prototyping my functions. Thanks to @TripeHound it is now know that structures have to be declared before prototyping a function and after further research it seems that there is no other way.