Question

I was trying to detect target operating system using c macros _WIN32 and _ CYGWIN_ but it shows error that _ CYGWIN_ is undeclared. How to use these macros to find target operating system

Was it helpful?

Solution

Try using #ifdef. For example:

#ifdef __CYGWIN__
  // Cygwin specific code
#else
  // Other code
#endif

OTHER TIPS

gcc on cygwin defines the macro __CYGWIN32__.

Take a look at GCC dump preprocessor defines to find all the macros defined by the preprocessor.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top