C代码宏的OS X版本(狮子与否)的检测? [英] C macro for OS X version (Lion or not) detection?

查看:140
本文介绍了C代码宏的OS X版本(狮子与否)的检测?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有pdefined C代码宏一$ P $检测OS X的版本?我知道 __ __ APPLE __ __ MACH 存在,但这些都是二进制的。是否有 __ __ APPLE_CC ,表示狮子特定值?

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 value for __APPLE_CC__ that indicates Lion?

在特定的,狮子添加的定义函数getline()< stdio.h中> 在狮子和这将是很好能够检测code是否被编译在Lion上还是不解决编译错误。

In particular, Lion added a definition of getline() to <stdio.h> in Lion and it would be nice to be able to detect whether or not code was compiling on Lion or not to work around compilation errors.

具体来说,我指的是在猛砸建设的Unix C code(外X $ C $的c)。

Specifically, I'm referring to building Unix C code in Bash (outside of XCode).

推荐答案

Availability.h 宏允许您检查之前编制和运行时版本依赖性。见讨论<一个href=\"http://developer.apple.com/library/mac/#documentation/DeveloperTools/Conceptual/cross_development/Using/using.html\"相对=nofollow>这里。

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

这篇关于C代码宏的OS X版本(狮子与否)的检测?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆