From: Matthew Mastracci Newsgroups: comp.os.msdos.djgpp Subject: Re: Why two identical typedef are considered an error in DJGPP? Date: Wed, 15 Jan 1997 08:24:02 -0700 Organization: The University of Calgary Lines: 37 Message-ID: References: <01IE7MKQWZ2Q003361 AT cc DOT uab DOT es> NNTP-Posting-Host: mmastrac AT acs2 DOT acs DOT ucalgary DOT ca Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII In-Reply-To: <01IE7MKQWZ2Q003361@cc.uab.es> To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp On Tue, 14 Jan 1997, x DOT pons AT cc DOT uab DOT es wrote: > If I write something like this in a xxx.h file > > typedef unsigned char BYTE; > > and I have *THE SAME* typedef in some other yyy.h file, > both included in the same .c file, the DJGPP compiler complains > that: > > file xxx.h line n redefinition of `BYTE' > file yyy.h line m `BYTE' previously declared here > Is there some way to avoid this error, which is not even a warning > in other compilers (provided, of course, that both definitions are > identical)? Try encapsulating the line with a define that checks for an arbitrary conditional (ie: BYTEdefined) and if it is not set, sets it and then defines the conditional. Pseudocode: if not defined "BYTEdefined" define "BYTEdefined" declare BYTE end if Put this in both places and you should have no problem with either one, no matter which order they are compiled in. /\/\att /\/\astracci mmastrac AT acs DOT ucalgary DOT ca GCS/GE d- s+:+ a--- C++++ UA P+ L E-- W+ N++ o K+ w+ O M- V PS++ PE++ Y+ PGP t+++ 5+++ X++ R++ tv+ b+++ DI++++ I G++ e h r* z?