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:

// Mac > 10.5 code here


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:



Of course there must be an easy way I missed


source to share

2 answers

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




You can write:

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


which will include <CarbonCore/Endian.h>

if (and only if) the macro is MAC_OS_X_VERSION_10_6

not defined.



All Articles