How to determine if mac SDK is * less * than

I have an app targeting a 10.5 minimum platform and it compiles fine with SDK 10.6 or 10.7

However, when compiling with an older version of xcode with 10.5 SDK, the compilation fails and requires some additional #import (why I'm not sure, but it is) When I import the OpenGL header, I get a message that some types are not allowed by adding:

#import fixes the problem (where are the missing characters)

I don't want to #import unless absolutely necessary, and in particular not when compiling with 10.6 or 10.7.

I know how to check if I am using an SDK that is superior to the given version, for example:

#if MAC_OS_X_VERSION_10_5 > MACS_VERSION_MIN_REQUIRED
// Mac > 10.5 code here
#endif

      

The problem is in verifying that the converse condition turned out to be non-trivial, since all later versions of the SDK have all the definitions found in earlier versions.

I would like to find the equivalent:

#if COMPILING_WITH_10_5_OR_EARLIER
blah
#endif

      

Of course there must be an easy way I missed

+3


source to share


2 answers


https://developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/cross_development/Using/using.html



#if __MAC_OS_X_VERSION_MAX_ALLOWED > 1050  // note use of 1050 instead of __MAC_10_5
#   include <security/pam_appl.h>
#else
#   include <pam/pam_appl.h>
#endif

      

+5


source


You can write:

#ifndef MAC_OS_X_VERSION_10_6
#include <CarbonCore/Endian.h>
#endif

      



which will include <CarbonCore/Endian.h>

if (and only if) the macro is MAC_OS_X_VERSION_10_6

not defined.

+1


source







All Articles