• Hello MLAers! We've re-enabled auto-approval for accounts. If you are still waiting on account approval, please check this thread for more information.

#ifdef in CodeWarrior Pro 5

zChris

6502
Hello!

This maybe a stupid question but i have searched and cannot find if CodeWarrior IDE 4 (CodeWarrior PRO 5 suite) supports conditional compilation instructions (macros).

So my question is if it supports #ifdef X and in that case how do i invoke the compiler with those options?

An example for gcc would be "gcc -D macro".

Thanks.
 
#ifdef X definitely does exist and works.

What I'm unsure of is where the UI to set which Xes are defined on a per-target basis lives, if it exists at all. It would be totally possible, but annoying, that the only way to define names would be to have #defines in the source code.

You can set a prefix file in the C compiler options, I note: so one way around this would be to have a header file that contains your #defines and set it as a prefix. That gets ... hairier in multi-target situations, but what doesn't?

Sorry this isn't more use.
 
You can easily create a 'top header' as a precompiled header with whatever you like to define in there... This will be "included" in every file you compile.
 
Back
Top