The first time the compiler comes across the function it doesn't know 
the prototype, so it assumes that it returns an int. Then when it comes 
across the function declaration it is different.

The "type" of a function is defined by the return type and the parameter 
types which must always match when the function is declared and when it 
is defined.

Add the following after the #include but before the main function:

unsigned short CRC16(unsigned char *puchMsg, unsigned short usDataLen);

This will define the function so nothing is assumed by the compiler.

Andy

Kirk Wallace wrote:
> At the risk of letting everyone know I am a C newbie. Oh ... you already
> know?
> 
> I am getting:
> 
> [EMAIL PROTECTED]:~/emc2/Modbus$ gcc -o modbus-1c modbus-1c.c
> modbus-1c.c:75: error: conflicting types for 'CRC16'
> modbus-1c.c:28: error: previous implicit declaration of 'CRC16' was here
> [EMAIL PROTECTED]:~/emc2/Modbus$
> 
> The offending code is here:
> 
> http://www.wallacecompany.com/machine_shop/EMC2/modbus/modbus-1c.c
> 
> I thought my call and return data types match, but some how they must
> not. Sometimes when I get messages I can't explain, I find it is
> because I haven't "#incude"'d something, but I played with some options
> that came to mind, without any luck. Can anyone point me in the proper
> direction? Thanks.
> 

-- 
Andy
PGP Key ID: 0x67090A54

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to