ObjC 宏 ifdef 和定义

ObjC macro ifdef and defined

我正在尝试做一个宏,如果 AAA 和 BBB 不存在。像这样:

#ifdef !AAA && !BBB
#endif

或者这个:

#ifndef AAA || BBB
#endif

但是,Xcode 向我抛出错误,所以我试过了 #ifdef !(defined AAA) && !(defined BBB) 或其他一些此类组合,似乎 Xcode 似乎无法理解定义。我收到 "Macro names must be identifiers" 或 "Extra tokens at the end of #ifdef directive" 错误。

知道如何解决这个问题吗?

你可以只使用 #if 吗?

#if !defined(AAA) && !defined(BBB)