Mail Archives: djgpp/1997/01/16/20:11:02
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?
- Raw text -