是否有预编译器定义告诉我我正在编译iOS?

时间:2012-03-11 10:21:13

标签: configuration c-preprocessor

是否有预编译器定义告诉我我正在编译iOS?

__APPLE__这样的东西让我知道我正在编译mac。

1 个答案:

答案 0 :(得分:3)

不确定;在海湾合作委员会:

#ifdef __APPLE__
  #include "TargetConditionals.h"

  #ifdef TARGET_OS_IPHONE
    // targeting the iPhone
  #elif TARGET_IPHONE_SIMULATOR
    // targeting the iOS simulator
  #elif TARGET_OS_MAC
    // targeting the Mac OS
  #else
    // unknown target platform
  #endif
#else
  // non-Apple platform
#endif
相关问题