【发布时间】:2016-05-03 04:01:54
【问题描述】:
我有一段代码可以改变不同平台之间的调用。但是我发现使用 iphone 和 ipad 有问题,TARGET_OS_IPHONE 定义只适用于 iphone,但没有 ipad,我不想尝试使用 else 认为是 ipad,因为将来这可能会成为问题的根源。
我已经失去了 2 天的时间来寻找由此引起的 opencv 矩阵中的颜色问题.....
我的问题,是否存在适当的解决方案官方在 iOS S.O (Iphone AND Ipad) 中执行一段代码?
作为参考,我总是查看this 链接。
选择代码示例:
#ifdef __linux__
// All linux arch
#elif _WIN32
// Windows 32 and 64
#elif __APPLE__
#ifdef TARGET_OS_IPHONE
// iOS, no work with iPAD
#elif TARGET_IPHONE_SIMULATOR
// iOS Simulator
#elif TARGET_OS_MAC
// Other kinds of Mac OS
#else
// Unsupported platform
#endif
#elif __ANDROID__
// Android all versions
#else
// Unsupported architecture
#endif
【问题讨论】:
标签: android ios cross-platform c-preprocessor