On 6 July 2012 07:22, Marcin S wrote: > Hello, > I have a problem with #if preprocessor instructions > My source file is compiled with -D__TARGET_PROCESSOR=STM32F103RB > > and example snippet IN source file: > > #if __TARGET_PROCESSOR==SOMETHING_ELSE > #error > #endif > > > And preprocessor always find this expression as TRUE no matter what > will be on right side. > Why? And how to make it right The preprocessor doesn't compare tokens by seeing if they have the same name. The preprocessor expands it to #if STM32F103RB == SOMETHING_ELSE The tokens STM32F103RB and SOMETHING_ELSE are not defined as macros so are both substituted with the constant 0, so your conditional is 0==0 which is always true. One way to do it is define the target processor as a macro, -DSTM32F103RB then test for it being defined: #ifdef STM32F103RB