I use two third party libraries that I don't have control over. I include header files from both of them like this.
#include <libraryA.h>
#include <libraryB.h>
libraryB has an enum like this:
enum class Animal
{
DOG,
CAT,
LION,
}
libraryA has a preprocessor directive like this:
#define DOG "dog"
In my program, if I include libraryA first and then include libraryB, the enum value DOG gets replaced by the string "dog" and everything fails. I am forced to include libraryB first, then include libraryA. While this time, this fix is simple enough for me, I wonder how to guard against this issue? Is there a way I can prevent a preprocessor directive of one library not apply on another library I'm including?