Reputation: 1602
I'd like to be able to put some macro commands in my C++ code running NetBeans (and GCC) eg.
#ifdef DEBUG
std::cout << "DistributionSuper constructor called" << std::endl;
#endif
Does anyone know if there's a way to use a debug compilation flag in NetBeans without having to do a -DDEBUG defines on the gcc command line? Checking the g++ compile lines didn't point to any defines I could use specific to debug, but I was hoping NetBeans might have a compile variable that does this somewhere. NetBeans does have some script variable like ${CND_CONF} that might help, but I can't really see a way to get at these in the C++ code. Thanks guys Pete
Upvotes: 1
Views: 1649
Reputation: 1602
After hunting around, couldn't find anything that would let you check debug status in the code with NetBeans compiles. Easiest way to solve the problem seems to be to do an explicity -DDEBUG in the project options, then use:
#ifdef DEBUG
#warning In debug mode
std::cout << "I was compiled with a DEBUG define in the g++ command line
#endif
Upvotes: 3