c - enum type not available -
i'm having problems enum type. have next in header:
enum map_type_t{ map_type_port, map_type_vlan, map_type_l2mac, mac_type_vpws, mac_type_bfd, mac_type_vpls };
i included header in c
file , that's eherre have prototype int store_to_flash (map_type_t map_type, void* pdata)
now, reason, type map_type_t
isn't beingness recognized, why not i'm wondering? i've tried typedef enum instead couldn't working either, looked like:
typedef enum { map_type_port, map_type_vlan, map_type_l2mac, mac_type_vpws, mac_type_bfd, mac_type_vpls }map_type_t;
what's problem, don't understand.
ps: diab
compiler in c99
mode
edit 1
interesting, if move
typedef enum map_type_e { map_type_port, map_type_vlan, map_type_l2mac, mac_type_vpws, mac_type_bfd, mac_type_vpls }map_type_t;
from header c file on top, after include
s seems work fine... that's odd isn't it? thought why might be?
the declaration
enum map_type_t { /* ... */ };
creates type named enum map_type_t
. identifier map_type_t
tag, not type name.
you can either utilize typedef
create alias type, or can refer name enum map_type_t
. (the typedef
in question should have worked; we'd have see more code know why didn't work you.)
similar rules apply struct
, union
type declarations.
(the rules different in c++.)
c enums typedef c99
No comments:
Post a Comment