68kMLA Classic Interface

This is a version of the 68kMLA forums for viewing on your favorite old mac. Visitors on modern platforms may prefer the main site.

Click here to select a new forum.
#ifdef in CodeWarrior Pro 5
Posted by: zChris on 2022-04-18 23:03:57
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.
Posted by: cheesestraws on 2022-04-19 01:26:19
#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.
Posted by: buserror on 2022-04-21 04:56:07
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.
1