cancel
Showing results for 
Search instead for 
Did you mean: 

Strip debug msg function calls during build

pulsar
Associate II

I have a bunch of debugMsg() calls throughout my code.  Is there a way to automatically strip those out during a build?

1 REPLY 1
Andrew Neil
Evangelist III

The usual way is to have something like:

 

#if defined DEBUG
#define debugMsg(x) output_stuff(x)
#else
#define debugMsg(x) 
#endif

 

thus debugMsg() effectively "disappears" in non-DEBUG builds.

 

This is general C practice - not specific to STM32 or CubeIDE.