redeclaration of enumerator

Posted by robUK on Stack Overflow See other posts from Stack Overflow or by robUK
Published on 2010-04-08T07:33:08Z Indexed on 2010/04/08 7:43 UTC
Read the original article Hit count: 651

Filed under:

Hello,

gcc 4.1.2 c99

I have the following enum's in this file ccsmd.h :

enum options_e
{
    acm = 0,
    anm,
    smd,
    OPTIONS_LAST_ENTRY,

    OPTIONS_ENTRY_COUNT = OPTIONS_LAST_ENTRY
};

enum function_mode_e
{
    play = 0,
    record,
    bridge,
    MODE_LAST_ENTRY,

    MODE_ENTRY_COUNT = MODE_LAST_ENTRY
};

error: redeclaration of enumerator ‘LAST_ENTRY’
error: previous definition of ‘LAST_ENTRY’ was here
error: redeclaration of enumerator ‘ENTRY_COUNT’
error: previous definition of ‘ENTRY_COUNT’ was here

I have the LAST_ENTRY so that I can use that as the index of an array. So I like to keep it the same across all enums.

Many thanks for any advice,

© Stack Overflow or respective owner

Related posts about c