I have a large number of files in my code base. I am trying to compile my code base using other library that has one file a.h. I am running into compilation problem if I include say a.h file in my code base that has already defined some of the values with same enum as defined in a.h. For example:
in "a.h" header file
typedef enum mylist_s
{
FIRST,
SECOND,
THIRD,
FOUR,
::::::
} mylist_e;
in other .cxx file as shown below (if it has definition same as defined in mylist)
static const char FIRST = 1;
I understand there is a definition of same variable again. I don't want to change my code base with new variable. Also since a.h is include in both .c and .cxx file I can not use namespace to encapsulate it with other name.
I also don't want to change name in a.h file. Is there an any other way I can handle this situation without changing enum value name.
Thanks in advance
namespaces were invented for. You can wrap theFIRST = 1in one.cxxfiles, not the header which you can't change.#includedirectives inside a namespace..