On Sun, Oct 25, 2009 at 9:12 PM, Christopher Coale <[email protected]> wrote:

> I'm trying to conditionally build a C++ project depending on the target
> platform. In short, I am looking for a macro in g++ that will tell me if
> I am compiling for *nix or Windows. I can use macros to check which
> compiler is being used, that is easy. The problem is finding out what
> operating system the compiler is compiling for. I can't (and don't want
> to) use autoconf, so please don't tell me to use that.
>
> On Windows, using DJGPP, the __unix__ macro is predefined in g++ for
> some reason, so I can't accurately use that. I can however check for
> MSVC to make sure it is being compiled on Windows, but that's it.

I think the standard symbols in gcc/g++ are __linux__, __solaris__,
__win32__, etc.

-- Brett
------------------------------------------------------------
"In the rhythm of music a secret is hidden;
    If I were to divulge it, it would overturn the world."
               -- Jelaleddin Rumi

Reply via email to