【发布时间】:2018-08-30 19:18:51
【问题描述】:
我有代码说(字面意思):
#define BUILD_PLATFORM ios
#if BUILD_PLATFORM==macos
#import <AppKit/AppKit.h>
#elif BUILD_PLATFORM==ios
#import <UIKit/UIKit.h>
#endif
但是,当我尝试构建项目时,它仍然尝试导入 AppKit/AppKit.h,导致找不到标头的错误。
我做错了什么?
【问题讨论】:
-
@Michael 这不是关于平台检测,而是更多关于引用 CMake 中定义的变量。
标签: objective-c c-preprocessor