delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/07/28/05:00:18

From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: conditional compilation for typedef
Date: Sun, 28 Jul 2002 09:48:37 +0100
Lines: 28
Message-ID: <3D43AFE5.879601E0@phekda.freeserve.co.uk>
References: <ai04lk$7i$1 AT news5 DOT jaring DOT my>
NNTP-Posting-Host: modem-81.sodium.dialup.pol.co.uk
Mime-Version: 1.0
X-Trace: news8.svr.pol.co.uk 1027846391 13546 62.136.10.81 (28 Jul 2002 08:53:11 GMT)
NNTP-Posting-Date: 28 Jul 2002 08:53:11 GMT
X-Complaints-To: abuse AT theplanet DOT net
X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.19 i586)
X-Accept-Language: de,fr
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Patrick Chen wrote:
[snip]
> lmouse3_video.h contains:
> typedef unsigned short word;
> 
> lmouse3_bitmap.h contains:
> typedef unsigned short word;
[snip]
>    Is there a condition compilation statement that can be put to every
> header file, so that whenever the first one is found by the pre-processor
> the other one will be ignored?
>    If not, please suggest a better style to declare typedef for developing
> program using multiple libraries.

Either put this in both header files:

#ifndef LMOUSE_WORD
typedef unsigned short word;
#define LMOUSE_WORD
#endif

or, better still, make a common definitions header, lmouse3_defs.h or
something, and include that from lmouse3_video.h and lmouse3_bitmap.h.

Regards,

-- 
Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]

- Raw text -


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