Hello, I am trying unsuccessfully to use directive compilers such as #ifdef #elif with Keil C v6.12 as follows: #if defined (TOTO) #include "toto.h" #elif defined (TATA) #include "tata.h" #elif defined (TITI) #include "titi.h" #endif I think it should work, but it doesn't. Before I was using : #if defined (TOTO) #include "toto.h" #endif #if defined (TATA) #include "tata.h" #endif #if defined (TITI) #include "titi.h" #endif But in some cases in my code that is not possible to do so, I have to use a #elif. If someone has experienced the same problem.... Thank you for your help Best regards, Christophe
which case(s) work? which don't? Are you sure that the cases are really mutually exclusive? Are you sure that the correct symbol is defined?
Keil compiler has a bug in that all #elifs are automatically of the "#if" nature, so the following thing won't work #ifdef TARGET_IS_ME ... #elif TARGET_IS_YOU // BUG !! must use defined(TARGET_IS_YOU) ... #endif /*I find one keil bug per month */