www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/15/13:12:14

From: jlouwere AT galaxy DOT csc DOT calpoly DOT edu (Jan Louwerens)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Why two identical typedef are considered an error in DJGPP?
Date: 15 Jan 1997 00:07:17 GMT
Organization: Cal Poly Computer Science Dept.
Lines: 34
Message-ID: <5bh73l$8lc@waldorf.csc.calpoly.edu>
References: <01IE7MKQWZ2Q003361 AT cc DOT uab DOT es>
NNTP-Posting-Host: galaxy.csc.calpoly.edu
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

x DOT pons AT cc DOT uab DOT es (ILGES AT cc DOT uab DOT es) wrote:
: Dear programmers,

: 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)?

: Thanks in advance,

: XP

try wrapping them with:

#ifndef BYTE
#define BYTE
typedef unsigned char BYTE
#endif

Of course it would be better to put it in just one include file having 
all of you typedefs and defines. (True, False, BYTE, WORD, DWORD, etc...)

JL

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019