Mail Archives: djgpp/1997/04/21/23:14:08
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 |
---------------------------------------------------------------------
- Raw text -