How to detect what SDK you are building for in Xcode

I recently had to build a file for multiple operating systems and had to figure out a way to enable a feature that is only available on Mac OS X 10.5 and greater, and Windows.

Here’s how I did it:

#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) || defined (_WIN32)
   #include 
#endif

Now, technically there is no harm with including omp.h with your Mac project, I’d like using that as an example as opposed to using Cocoa.h/Afx.h.

Leave a Reply

Your email address will not be published. Required fields are marked *