For Mac OS:
#ifdef __APPLE__
For MingW on Windows:
#ifdef __MINGW32__
For Linux:
#ifdef __linux__
For other Windows compilers, check this thread and this for several other compilers and architectures.
More Related Contents:
- How to detect reliably Mac OS X, iOS, Linux, Windows in C preprocessor? [duplicate]
- Comma in C/C++ macro
- Can we have recursive macros?
- Escaping a # symbol in a #define macro?
- macro definition containing #include directive
- Can I redefine a C++ macro then define it back?
- Confused by squaring macro SQR in c [duplicate]
- What is the NDEBUG preprocessor macro used for (on different platforms)?
- How to tame the Windows headers (useful defines)?
- Expand macro inside string literal
- Overloading Macro on Number of Arguments
- C++ preprocessor __VA_ARGS__ number of arguments
- What exactly do C include guards do?
- Array-size macro that rejects pointers
- Can you make custom operators in C++?
- C/C++, can you #include a file into a string literal? [duplicate]
- Is #pragma once part of the C++11 standard?
- Why do I need double layer of indirection for macros?
- Portability of #warning preprocessor directive
- What are C macros useful for?
- Is there a 128 bit integer in C++?
- Opposite of C preprocessor “stringification”
- C/C++ macro/template blackmagic to generate unique name
- Difference between Enum and Define Statements
- What is the difference between a macro and a const in C++?
- What does “#define STR(a) #a” do?
- C# Macro definitions in Preprocessor
- “No newline at end of file” compiler warning
- C++ #include semantics
- Generate include file name in a macro