A workaround for a magical evil wizard: if namespaces do not help (for any reason), and you absolutely cannot avoid including both definitions in the same file, use a macro:
#define Month File_A_Month #include "file_a.h" #define Month File_B_Month #include "file_b.h" #undef Month
Never use Month in a file, only File_A_Month or File_B_Month . I am not sure of the correctness of this practice.
You may need to define all the members of the enumeration in the same way as conflict prevention, and you probably want to put this evil hacker in a file called files_a_and_b.h . Of course, in your case the definitions are identical, so you do not need to resort to this, but I leave this answer here for less successful offspring.
source share