Reputation: 520
I have my following functions declared in stack.h file and when I compile my project an error Unknown type name is been shown for l_ifc_handle.
extern l_bool l_ifc_init (l_ifc_handle iii);
extern void l_ifc_wake_up (l_ifc_handle iii);
extern void l_ifc_rx (l_ifc_handle iii);
extern void l_ifc_tx (l_ifc_handle iii);
extern l_u16 l_ifc_read_status (l_ifc_handle iii);
extern void l_ifc_aux (l_ifc_handle iii);
extern l_u16 l_sys_irq_disable (l_ifc_handle iii);
extern void l_sys_irq_restore (l_ifc_handle iii);
But my l_ifc_handle
is structure variable in another file called driver.h and used in driver.c
typedef enum {
LI0
}l_ifc_handle;
This driver.h file includes my stack.h header file. But the l_ifc_handle
is in my driver.h file.
If I use
typedef enum {
LI0
} extern l_ifc_handle;
then it gives an error called multiple storage classes. In which file should I place the above typedef?
Upvotes: 1
Views: 2525
Reputation: 38440
Do not include driver.h
into stack.h
. Use forward declarations instead and include driver.h
into you .c
files when you need LI0
.
extern l_bool l_ifc_init (enum l_ifc_handle iii);
extern void l_ifc_wake_up (enum l_ifc_handle iii);
extern void l_ifc_rx (enum l_ifc_handle iii);
extern void l_ifc_tx (enum l_ifc_handle iii);
extern l_u16 l_ifc_read_status (enum l_ifc_handle iii);
extern void l_ifc_aux (enum l_ifc_handle iii);
extern l_u16 l_sys_irq_disable (enum l_ifc_handle iii);
extern void l_sys_irq_restore (enum l_ifc_handle iii);
Upvotes: 0
Reputation: 1018
typedef enum {
LI0
} extern l_ifc_handle;
then it gives an error called multiple storage classes.
Storage specifier(typedef, auto, static, register, extern
) are mutual exclusive, You can't use them in same declaration.
Is typedef a storage-class-specifier?
Upvotes: 5