Date: Sun, 20 Feb 2005 13:03:21 -0800 From: "Michael C. Shultz" <reso3w83@verizon.net> To: freebsd-hackers@freebsd.org Subject: Re: Error in my C programming Message-ID: <200502201303.22117.reso3w83@verizon.net> In-Reply-To: <Pine.LNX.4.58.0502201239090.3359@durable> References: <4218B960.1050403@kaqelectronics.dyndns.org> <200502201208.18130.reso3w83@verizon.net> <Pine.LNX.4.58.0502201239090.3359@durable>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sunday 20 February 2005 12:41 pm, Richard Sharpe wrote: > On Sun, 20 Feb 2005, Michael C. Shultz wrote: > > > >> Here is a section of my code: > > > >> > > > >> *** Wtrend_Drivers.c *** > > > >> > > > >> (12)void Reset_Network (unsigned char Network) > > > >> (13) { > > > >> (14) Length = 0x00; > > > >> (15) Receiver = 0x00; > > > >> (16) Node = 0xFF; > > > >> (17) Command = Reset; > > > >> (18) Make_Packet_Send(Head , Length, Network, Receiver, > > > >> Node, Command, p_Data); > > > >> (19) } > > > >> > > > >> *** Wtrend_Drivers.h *** > > > >> > > > >> unsigned char Length , Network , Receiver , Node , Command = > > > >> 0x00; > > > >> > > > >> The above is line 9 of the Wtrend_Drivers.h > > > >> The numbers in () I have added to show the line numbers in > > > >> Wtrend_Drivers.c > > > >> > > > >> These are some of the errors I get in pairs for each of the > > > >> above variables: > > > >> > > > >> Wtrend_Drivers.c:15: conflicting types for `Receiver' > > > >> Wtrend_Drivers.h:9: previous declaration of `Receiver' > > > > > > > > I would try putting the variables in the header file on > > > > separate lines. For example: > > > > > > > > unsigned char Length = 0; > > > > unsigned char Network = 0; > > > > unsigned char Receiver = 0; > > > > etc. > > > > > > Done that to no avail :( > > > > > > Regards, > > > > > > Kat. > > > > I wonder if Receiver is defined in a include file elsewhere? I > > checked all the header files on my system and it isn't, perhaps it > > is on your though? Maybe easier to rename it? > > However, the error messages point out that the conflicting definition > is where Receiver is first used in the function in the .c file. If it > was another definition, we would be told of the actual .h file where > the definition came from. I have seen that lots of times :-) > > Regards Your right. We do not have enough of her code. I tried this: #include <stdio.h> unsigned char Receiver = 0; int main(void) { Receiver = 0x00; printf( "Receiver -=>%c\n", Receiver ); return(0); } compiled it with: gcc -W -Wall -ansi -pedantic -Wbad-function-cast -Wcast-align \ -Wcast-qual -Wchar-subscripts -Winline \ -Wmissing-prototypes -Wnested-externs -Wpointer-arith \ -Wredundant-decls -Wshadow -Wstrict-prototypes zz.c -o zz and no warnings.... -Mike
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200502201303.22117.reso3w83>