From: "John M. Aldrich" Newsgroups: comp.os.msdos.djgpp Subject: Re: dos/unix defines Date: Mon, 21 Apr 1997 08:40:39 +0000 Organization: Two pounds of chaos and a pinch of salt Lines: 23 Message-ID: <335B2807.2636@NO.SPAM.cs.com> References: Reply-To: fighteer AT cs DOT com NNTP-Posting-Host: ppp108.cs.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Andrew Deren wrote: > > Does anyone know what #define I have to use to detect whether a program is > compiled on DOS or UNIX. I use Borland C++ and DJGPP for DOS and gcc and > CC for unix if that matters. You can pass the '-E -dM' parameters to gcc to see only a list of the preprocessor macros that are defined when you compile your programs. To detect Unix, use #ifdef(unix). To detect MS-DOS, use #ifdef(MSDOS). To detect DJGPP, use #ifdef(DJGPP). To detect GNU C, use #ifdef(__GNUC__). On some compilers (such as DJGPP), both 'unix' and 'MSDOS' will be defined due to the nature of the compiler. -- --------------------------------------------------------------------- | John M. Aldrich, aka Fighteer I | mailto:fighteer AT cs DOT com | | Proud owner of what might one | http://www.cs.com/fighteer | | day be a spectacular MUD... | Plan: To make Bill Gates suffer | ---------------------------------------------------------------------