C macro for OS X version (Lion or not) detection?

后端 未结 2 603
无人及你
无人及你 2020-12-20 17:43

Is there a predefined C macro for detecting the version of OS X? I know __APPLE__ and __MACH__ exist, but those are binary. Is there a specific val

相关标签:
2条回答
  • 2020-12-20 18:09

    The Availability.h macros allow you to check for compile- and run-time version dependencies. See the discussion here.

    0 讨论(0)
  • 2020-12-20 18:24

    Check in /usr/include/AvailabilityMacros.h - it contains macros such as:

    #if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7
        #define DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER    DEPRECATED_ATTRIBUTE
    #else
        #define DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
    #endif
    

    I came across this stuff because 'openssl/sha1.h' has been slathered with 'deprecated' attributes for Lion, so compiling git gets warnings galore.

    0 讨论(0)
提交回复
热议问题