I have defined an enum in a header file, global.h:
Typedef enum
{
ELEMENT1,
ELEMENT2,
ELEMENT3
}e_element;
I have a second file using the enum as a function parameter. file2.c
#include global.h
#include file2.h
Function(e_element x)
{
Body…
}
The prototype is in: file2.h
Function(e_element x);
The compiler doesn’t know e_element in file2.h. I have tried putting the #include for global.h in both file2.c and file2.h, but it still doesn’t see it. I would put the enum in file2.h, except that it is used by several other files, so if I move it the problem will just show up somewhere else.
How can I get the file2.h prototype to see e_element?
typedef, notTypedef. When I fix that, and add quotes around the header files in#include, your code compiles.