Build configurations

08 Jul 2010

Hi.

Is it possible to have different build configurations such as a debug and release build configurations?

Debug output for example could be sent to the serial port but this would not be required for mature code.

 

Regards.

Martin

08 Jul 2010

I do this through #define and #ifdef statements with a common header file included in all my source files - a simplistic approach when the IDE does not directly support this feature.  The header file carries the release/debug definitions and the source code has snippets such as:

In the header file:

#define DEBUG 1 // '1' will include the #ifdef code

 

In the source files:

#ifdef DEBUG

printf("XXXXX");

#endif  

08 Jul 2010

Hi.

Thanks for the reply I was already using this mechanism and thought there maybe a more elegant way.

On another note do you know of a mechanism of only including header files once such as #pragma once instead of the usual:-

#ifndef _BLAH_

#define _BLAH_

blah..

blah..

#endif

 

 

 

Regards.

Martin

09 Jul 2010

I've not tried it, but perhaps #import works? That should only include things once.... It's objective-c so it'll depend if it's supported in the Keil compiler.

Cheers,

James.