1

When compiling a header file using XL C on AIX, I get a (1506-045 (S)) "Undeclared Identifier " error for each enumerated value of an enumerated type being defined. For the life of me, I can't find any syntax or logical errors in the file, and there are similar enums compiling fine in other files. The only difference I could find with this file is that the enumerations are specifically defined as their numeric values. The following code is what the compiler is flagging as an error:

typedef enum
{
    ENUM_VAL_0 = 0,
    ENUM_VAL_1 = 1,
    ....
    ENUM_VAL_10 = 10
} MY_BAD_ENUM_TYPE;

as opposed to implicitly defined values in other enums, which compiles with no error:

typedef enum
{
    ENUM_VAL_0,
    ENUM_VAL_1,
    ...
    ENUM_VAL_10
} MY_GOOD_ENUM_TYPE;

Does anyone know if XL C has a problem with explicitly defining your enumerated values? Is there a flag or option for the compiler that affects this? I was under the impression that explicitly defining your enumerated values, while mostly pointless, was not a problem in C. Bad assumption?

Has anyone had any experience with something like this?

UPDATE

As requested by @kaylum, here is the full source code, with the lines that precede the issue are:

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;

and here are the corresponding compiler errors:

"/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.

Let me know if this is actually more helpful.

Mr. Gravy
  • 23
  • 4
  • Assigning values has been allowed since enums were introduced. I see nothing wrong with your syntax. However, you might try defining the enum first and then typedefing it. For example, `enum MY_ENUM {...};` followed by `typedef enum MY_ENUM MY_BAD_ENUM_TYPE;` – user3386109 Jan 22 '16 at 21:02
  • 2
    Show complete example code. Show the actual and exact error for that example. That is, your question needs more information. See [How to create a minimal complete and verifiable example](http://stackoverflow.com/help/mcve) – kaylum Jan 22 '16 at 21:05
  • Thanks @user3386109. The MY_GOOD_ENUM_TYPE isn't used that way, but I'll try it out. – Mr. Gravy Jan 22 '16 at 21:07
  • @MrGravy Note that kaylum may be right. You may have a syntax error just *before* the `typedef enum` that confuses the compiler. – user3386109 Jan 22 '16 at 21:17
  • you left out about 200 lines from the "full source code" – covener Jan 23 '16 at 04:58
  • If Clang, GCC, and one other vendor compiler don't throw an error with strict compile flags, it's reasonable to say it's a bug and you should file a PMR with IBM. – Jeff Hammond Jan 23 '16 at 16:21

0 Answers0