Hi,
Im sure this is probably simple, I just have not found the answer.
I have several targets in one project (CW7.2), when I select a target, I need to change what code compiles without manually defining a name and including that in everything. Something like this:
#ifdef Target1
.... some code ....
#endif
...some more code ...
#ifdefine Target2
... some more code ...
#endif
Is this possible?I have read the help files and came up with nothing...
Thanks,
Carl
Solved! Go to Solution.
Hello
You can specify the macro you want to use in the Target Setting's C/C++ Preprocessor panel.
- Open the Target Settings dialog (Press ALT+F7)
- Go to Language Settings > C/C++ Preprocessor panel
- Add your define in the Prefix Text edit box.
For example in the setting for target 1 specify
#define Target1
these settings are target specific. So just add the appropriate define for each target.
CrasyCat
Hello
You can specify the macro you want to use in the Target Setting's C/C++ Preprocessor panel.
- Open the Target Settings dialog (Press ALT+F7)
- Go to Language Settings > C/C++ Preprocessor panel
- Add your define in the Prefix Text edit box.
For example in the setting for target 1 specify
#define Target1
these settings are target specific. So just add the appropriate define for each target.
CrasyCat
Ahhh, so simple, the worst part is I found I have previously modified this for other reasons!
Thanks,
Carl
Hi,
How do I modify the Coldfire preprocessor in CW10.1? There appears to be an option for HCS08 projects, but not Coldfire...? And I have done it successfully in CW7.2.
Thanks,
Carl Norman
Apparently there is nothing available for CW10.1 for coldfire...
Here is a work around:
Hello
Did you consider creating a .h file containing all the #define for your configuration and specifying it as a prefix file in C-C++ Build > Settings > Tool Settings > ColdFire Compiler > Input > Prefix File edit box.
Just switch the prefix file for the other configurations.
CrasyCat
Thanks, I just ported over to using this Prefix file method as it was getting to messy.
Would be nice if the IDE was aware of this, the IDE is unaware of definitions in this file so its also quite useless. Any idea how to get the IDE to be aware of the prefix file?
If I do something like this in the prefix file
#define _TEST_
Then in my code
#ifdef _TEST_
#warning TEST
#endif
This entire statement is in gray as the IDE is not aware of _TEST_ being defined, yet it highlights the #warning as something is aware the #warning statement is there...