I don't have experience with Keil IDE's, so, I'm not sure how to configure it to build different binaries with different macro definitions, but, it's a common C thing, there should be way to do it.Īnother option would be to make these globals. This option is the only way if you use these constants to, say, dimension an array. Of course, if you have a lot of constants, maybe keeping each platform in its own header would be better (easier to read). I'll assume your constants are macros, but, it should not be different if they are enums or something else.įirst option is to use the preprocessor to select your platform. Let me show you two ways to solve your problem which I believe are much better. Understanding where you're coming from, I would not recommend going down the road you suggested.