Tuesday, April 9, 2013

warning C4005: 'ZONE_ERROR' : macro redefinition


Hi Folks,

Sometimes when you work with DEBUG ZONES under Windows Embedded Compact, you will get one of the following warnings when compiling your code:

warning C4005: 'ZONE_INIT' : macro redefinition
warning C4005: 'ZONE_WARNING' : macro redefinition
warning C4005: 'ZONE_ERROR' : macro redefinition

Although, it’s not a must, it is very common to name your DEBUG ZONES ZONE_INIT, ZONE_WARNING, ZONE_ERROR, etc. hence the high probability of a redefinition.

To fix this compiler warning simply undefined the DEBUG ZONE defines in question right before defining them in your driver:

#ifdef ZONE_INIT
#undef ZONE_INIT
#endif
#ifdef ZONE_WARNING
#undef ZONE_WARNING
#endif
#ifdef ZONE_ERROR
#undef ZONE_ERROR
#endif

#define ZONE_INIT…

Have fun!

No comments:

Post a Comment