From: Richard Dawe 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: NNTP-Posting-Host: modem-81.sodium.dialup.pol.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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/ ]