Reputation: 2241
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!
Upvotes: 0
Views: 766
Reputation: 76519
Standard C mentions NDEBUG
in the context of <assert.h>
; when it is defined, assert
s do nothing.
Otherwise there is no standard macro, and the safest path is to define something yourself.
Upvotes: 1