When developing an application it is sometimes necessary to add code that will not be wanted in the final code. Fx. tracing code.
Defining the conditional constant
To make a conditional compilation you need to define a constant that tells which condition is the current.
This can be done directly in the sourcecode, but then you have to do it in all sourcefiles that use it.
#define Test
This can be handy for a small test, but if you have a general condition that is used across sourcefiles its a bit shaky. So you need to add it to the general build configuration in the projects properties.
As you can see here you have access to default constants TRACE and DEBUG.
Using the condition
When using the condition just add #if #else #endif around the conditional code.
#if Test
Runtestcode
#else
Runprocode
#endif
you can of course use the TRACE and DEBUG code here.