Given a C project that needs to support multiple environments, how do I use the preprocessor to enforce that exactly one environment is defined?
I can already do
#if defined PROJA
(blah blah blah)
#elif defined PROJB
(etc)
#else
#error "No project defined"
#endif
All that does, though, is tell me if 0 projects are defined. If some helpful soul defines both project A and project B, the preprocessor will assume only project A. However, the correct behavior, from my perspective, is to flag an error.
Granted, with only 2 projects defined this problem is trivial. How do I solve it with 200?