I have some code which has some code that looks like this one here (I simplified it, of course)
#define ERROR 0
namespace lib{
class Logger{
public:
typedef enum {ERROR = 1} LogLevel;
};
}
When compiling in visual studio I get the error: syntax error: 'constant'
. It is clear that the problem is that I am re-using the word ERROR for the define and the typedef enum.
Does anyone know the logic of the define influencing some variable name that is is fact included inside a namespace and a class. I mean, how can ERROR
be confused with lib::Logger::ERROR
since my guess is that they have completely different scopes.