在 AIX 上使用 XL C 编译头文件时,对于正在定义的枚举类型的每个枚举值,我都会收到 (1506-045 (S))“未声明的标识符”错误。对于我的一生,我在文件中找不到任何语法或逻辑错误,并且在其他文件中也有类似的枚举编译得很好。我能发现这个文件的唯一区别是枚举被明确定义为它们的数值。以下代码是编译器标记为错误的代码:
typedef enum
{
ENUM_VAL_0 = 0,
ENUM_VAL_1 = 1,
....
ENUM_VAL_10 = 10
} MY_BAD_ENUM_TYPE;
与其他枚举中隐式定义的值相反,它编译时没有错误:
typedef enum
{
ENUM_VAL_0,
ENUM_VAL_1,
...
ENUM_VAL_10
} MY_GOOD_ENUM_TYPE;
有谁知道 XL C 在明确定义您的枚举值时是否有问题?编译器是否有影响这一点的标志或选项?我的印象是,明确定义您的枚举值虽然大多毫无意义,但在 C 语言中不是问题。错误的假设?
有没有人有过这样的经历?
更新
根据@kaylum 的要求,这里是完整的源代码,问题之前的行是:
typedef FLOAT_32 WAAS_FAST_CORRECTION_TYPE;
/******************************************************************************/
/* Enumerated type of all possible types of WAAS GEO messages */
/* Data Element: Derived_Msg_Type */
/******************************************************************************/
typedef enum
{
WAAS_GEO_MSG0_TYPE = 0,
WAAS_GEO_MSG1_TYPE = 1,
WAAS_GEO_MSG2_TYPE = 2,
WAAS_GEO_MSG3_TYPE = 3,
WAAS_GEO_MSG4_TYPE = 4,
WAAS_GEO_MSG5_TYPE = 5,
WAAS_GEO_MSG6_TYPE = 6,
WAAS_GEO_MSG7_TYPE = 7,
WAAS_GEO_MSG8_TYPE = 8,
WAAS_GEO_MSG9_TYPE = 9,
WAAS_GEO_MSG10_TYPE = 10,
WAAS_GEO_MSG12_TYPE = 12,
WAAS_GEO_MSG17_TYPE = 17,
WAAS_GEO_MSG18_TYPE = 18,
WAAS_GEO_MSG24_TYPE = 24,
WAAS_GEO_MSG25_TYPE = 25,
WAAS_GEO_MSG26_TYPE = 26,
WAAS_GEO_MSG28_TYPE = 28,
WAAS_GEO_MSG0_ZERO_FILL = 61,
WAAS_GEO_MSG62_TYPE = 62,
WAAS_GEO_MSG63_TYPE = 63,
WAAS_GEO_LAST_MSG = 64,
WAAS_GEO_INVALID_TYPE = 99
} WAAS_GEO_ENUM_MSG_TYPE;
以下是相应的编译器错误:
"/build/WLNAV/builds/W7.134C/lib_source/WAAS_GEO_message_types.h", line 237.5: 1506-045 (S) Undeclared identifier WAAS_GEO_MSG0_TYPE.
"/build/WLNAV/builds/W7.134C/lib_source/WAAS_GEO_message_types.h", line 238.5: 1506-045 (S) Undeclared identifier WAAS_GEO_MSG1_TYPE.
"/build/WLNAV/builds/W7.134C/lib_source/WAAS_GEO_message_types.h", line 239.5: 1506-045 (S) Undeclared identifier WAAS_GEO_MSG2_TYPE.
"/build/WLNAV/builds/W7.134C/lib_source/WAAS_GEO_message_types.h", line 240.5: 1506-045 (S) Undeclared identifier WAAS_GEO_MSG3_TYPE.
"/build/WLNAV/builds/W7.134C/lib_source/WAAS_GEO_message_types.h", line 241.5: 1506-045 (S) Undeclared identifier WAAS_GEO_MSG4_TYPE.
"/build/WLNAV/builds/W7.134C/lib_source/WAAS_GEO_message_types.h", line 242.5: 1506-045 (S) Undeclared identifier WAAS_GEO_MSG5_TYPE.
"/build/WLNAV/builds/W7.134C/lib_source/WAAS_GEO_message_types.h", line 243.5: 1506-045 (S) Undeclared identifier WAAS_GEO_MSG6_TYPE.
"/build/WLNAV/builds/W7.134C/lib_source/WAAS_GEO_message_types.h", line 244.5: 1506-045 (S) Undeclared identifier WAAS_GEO_MSG7_TYPE.
"/build/WLNAV/builds/W7.134C/lib_source/WAAS_GEO_message_types.h", line 250.5: 1506-045 (S) Undeclared identifier WAAS_GEO_MSG8_TYPE.
"/build/WLNAV/builds/W7.134C/lib_source/WAAS_GEO_message_types.h", line 252.5: 1506-045 (S) Undeclared identifier WAAS_GEO_MSG9_TYPE.
"/build/WLNAV/builds/W7.134C/lib_source/WAAS_GEO_message_types.h", line 253.5: 1506-045 (S) Undeclared identifier WAAS_GEO_MSG10_TYPE.
"/build/WLNAV/builds/W7.134C/lib_source/WAAS_GEO_message_types.h", line 254.5: 1506-045 (S) Undeclared identifier WAAS_GEO_MSG12_TYPE.
"/build/WLNAV/builds/W7.134C/lib_source/WAAS_GEO_message_types.h", line 255.5: 1506-045 (S) Undeclared identifier WAAS_GEO_MSG17_TYPE.
"/build/WLNAV/builds/W7.134C/lib_source/WAAS_GEO_message_types.h", line 256.5: 1506-045 (S) Undeclared identifier WAAS_GEO_MSG18_TYPE.
"/build/WLNAV/builds/W7.134C/lib_source/WAAS_GEO_message_types.h", line 257.5: 1506-045 (S) Undeclared identifier WAAS_GEO_MSG24_TYPE.
"/build/WLNAV/builds/W7.134C/lib_source/WAAS_GEO_message_types.h", line 258.5: 1506-045 (S) Undeclared identifier WAAS_GEO_MSG25_TYPE.
"/build/WLNAV/builds/W7.134C/lib_source/WAAS_GEO_message_types.h", line 259.5: 1506-045 (S) Undeclared identifier WAAS_GEO_MSG26_TYPE.
"/build/WLNAV/builds/W7.134C/lib_source/WAAS_GEO_message_types.h", line 260.5: 1506-045 (S) Undeclared identifier WAAS_GEO_MSG28_TYPE.
"/build/WLNAV/builds/W7.134C/lib_source/WAAS_GEO_message_types.h", line 264.5: 1506-045 (S) Undeclared identifier WAAS_GEO_MSG0_ZERO_FILL.
"/build/WLNAV/builds/W7.134C/lib_source/WAAS_GEO_message_types.h", line 265.5: 1506-045 (S) Undeclared identifier WAAS_GEO_MSG62_TYPE.
"/build/WLNAV/builds/W7.134C/lib_source/WAAS_GEO_message_types.h", line 266.5: 1506-045 (S) Undeclared identifier WAAS_GEO_MSG63_TYPE.
"/build/WLNAV/builds/W7.134C/lib_source/WAAS_GEO_message_types.h", line 267.5: 1506-045 (S) Undeclared identifier WAAS_GEO_LAST_MSG.
"/build/WLNAV/builds/W7.134C/lib_source/WAAS_GEO_message_types.h", line 268.5: 1506-045 (S) Undeclared identifier WAAS_GEO_INVALID_TYPE.
"/build/WLNAV/builds/W7.134C/lib_source/WAAS_GEO_message_types.h", line 270.1: 1506-277 (S) Syntax error: possible missing ';' or ','?
"/build/WLNAV/builds/W7.134C/lib_source/WAAS_GEO_message_types.h", line 270.3: 1506-273 (E) Missing type in declaration of WAAS_GEO_ENUM_MSG_TYPE.
让我知道这是否真的更有帮助。