From owner-freebsd-hackers@FreeBSD.ORG Mon Feb 21 00:53:16 2005 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0AF8716A4CF for ; Mon, 21 Feb 2005 00:53:16 +0000 (GMT) Received: from smtp804.mail.sc5.yahoo.com (smtp804.mail.sc5.yahoo.com [66.163.168.183]) by mx1.FreeBSD.org (Postfix) with SMTP id 5E73243D5E for ; Mon, 21 Feb 2005 00:53:15 +0000 (GMT) (envelope-from rsharpe@richardsharpe.com) Received: from unknown (HELO ns.aus.com) (ngsharpe1@sbcglobal.net@67.125.87.116 with plain) by smtp804.mail.sc5.yahoo.com with SMTP; 21 Feb 2005 00:53:15 -0000 Received: from ns.aus.com (durable [127.0.0.1]) by ns.aus.com (8.12.11/8.12.8) with ESMTP id j1L0l3gl006259; Sun, 20 Feb 2005 16:47:10 -0800 Received: from localhost (rsharpe@localhost) by ns.aus.com (8.12.11/8.12.11/Submit) with ESMTP id j1L0kp21006256; Sun, 20 Feb 2005 16:47:03 -0800 X-Authentication-Warning: ns.aus.com: rsharpe owned process doing -bs Date: Sun, 20 Feb 2005 16:46:51 -0800 (PST) From: Richard Sharpe X-X-Sender: rsharpe@durable To: "Michael C. Shultz" In-Reply-To: <200502201303.22117.reso3w83@verizon.net> Message-ID: References: <4218B960.1050403@kaqelectronics.dyndns.org> <200502201303.22117.reso3w83@verizon.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: freebsd-hackers@freebsd.org Subject: Re: Error in my C programming X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Feb 2005 00:53:16 -0000 On Sun, 20 Feb 2005, Michael C. Shultz wrote: > > > > >> *** 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' [Deletia ..] > > > 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 > 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.... In private correspondence with the person asking the question it was indicated that initially GCC was used with no flags. Regards ----- Richard Sharpe, rsharpe[at]richardsharpe.com, rsharpe[at]samba.org, sharpe[at]ethereal.com, http://www.richardsharpe.com