Xcode - 带枚举的typedef - 预期'}'

时间:2014-07-16 09:39:56

标签: ios c xcode enums typedef

我正在研究Xcode 5.1.1并且我在一个应该完美运行的C文件中出错。

typedef enum {NO = 0, YES = 1} EnBool;
! Expected '}'

调试器专注于第一个大括号,它就像它不需要它,而后面有一个枚举。

1 个答案:

答案 0 :(得分:2)

NOYESObjective C中的关键字(实际上是宏),您不能将它们用作枚举标签。

它在objc.h中定义,它的实现如下:


Bool


使用任何其他标签,如:

typedef enum {nothing = 0, something = 1} EnBool;