I have a file header.h which has include guards:
#ifndef HEADER_H
#define HEADER_H
typedef enum {
ENUM_1,
ENUM_2,
} enumerator;
typedef struct {
uint8_t struct_field_1;
bool struct_field_2;
} structName
void functionName(uint8_t arg1, uint32_t arg2);
#endif
header.h is included in file1.h and file2.h (#include <header.h>)
Then foo.c includes file1.h and file2.h as a relative path
#include "../../../file1.h"
#include "../../../file2.h"
I'm getting compile errors such as "previous declaration of 'structName' was here" and "conflicting types for 'enumerator'". Why is this happening even with include guards and how do I fix it?
header.h has not been included in any C files. header.h also does not contain function definitions (only declarations, and some enums)
How to avoid "multiple definition" error for global constants? mentions separating definitions and declarations but I have already done that