I am using Eclipse for several C++ projects. I’d like to have some bits of purely debug code. I expected this to work:
#ifdef DEBUG
do_something();
#endif
but, alas, DEBUG is undefined.
Is there another #defined “word” that means DEBUG? Or will I need to add a -DDEBUG to the compiler flags for the debug configuration.
Thanks!
Standard C mentions
NDEBUGin the context of<assert.h>; when it is defined,asserts do nothing.Otherwise there is no standard macro, and the safest path is to define something yourself.