Search code examples
mingwconditional-compilationpreprocessor-directive

#ifdef MINGW32 then ...don't compile this


I would like to add compiler directives in the code to say, if we compile with mingw, then don't take this piece of code into consideration.

For example:

#ifdef _MINGW32_   //if this defined then don't compile the code
int x;
code....
#endif

Is it possible? How to do that?


Solution

  • #ifndef, (or #if ! defined) does the opposite of #ifdef.