Is it possible to use system or project macros within code?

Comments

4 comments

  • Avatar
    Kelly Painter
    Could you use the project properties Preprocessor Options -> Preprocessor Definitions and define DEV_DEBUG, etc for each configuration? Then you could use #ifdef DEV_DEBUG ...
    0
    Comment actions Permalink
  • Avatar
    Darcy Williams

    Yes, that's kind of a last resort though due to the number of projects I'd need to go through and make all those changes to.  But yes, that's one way to do it.  The functionality appears to be available in CrossWorks, I'm just not sure if it'll let me do it this way  :-)

    0
    Comment actions Permalink
  • Avatar
    Jon Elliott

    As long as your configuration names don't have any spaces in them (which appears to be the case), you could do something like add a "CONF_$(Configuration)" preprocessor definition. Then you could use the following code:

    #if defined(CONF_Dev_Debug)

    ...

    #elif defined(CONF_Dev_Release)

    ...

    #elif defined(CONF_Formal_Release)

    ...

    #endif

    0
    Comment actions Permalink
  • Avatar
    Darcy Williams

    Thanks Jon.  That's an interesting twist on the prepro definitions method.  Bugger all difference in work (since I'd still need to edit every project rather than just a single shared source file) but I like the idea

    0
    Comment actions Permalink

Please sign in to leave a comment.