How to undefine and redefine a macro in C++?

118 Views Asked by At

I have a macro in the existing part of project that I want to suppress for my includes. The existing macro is defined like this:

#define NAME                _T(MYCONST("Name"))

However In my library NAME is part of an enum that raise error.

I tried to do it like this:

#ifdef MYCONST
#define CONST_DEFINED MYCONST
#undef MYCONST
#endif
#include <boost/beast/core.hpp> ...
#ifdef CONST_DEFINED
#define MYCONSTCONST_DEFINED
#undef CONST_DEFINED
#endif

However, in other parts of code that used the MYCONST like dir += MYCONST("lockapp");, I have error E0020 that identifier CONST_DEFINED is undefined!

0

There are 0 best solutions below