The following code consists of a config.h file, and a main.c file, both in the same project directory. When I change the define value, in config.h, and then do a build, or even a rebuild all, and then check the value in the SOME_CALC_USING_CONFIG constant [in the main.c file], the value doesn't change -- suggesting the pre-processor didn't detect the change I made in the SOME_DEFED_VAL value, and thus didn't recalculate the constant - even though, if I Ctrl+Space on the SOME_DEFED_VAL in the main.c file, it shows the new value!
BUT
If I make any sort of change in in the main.c file, the SOME_CALC_USING_CONFIG value updates to the proper value [i.e. the calculation is performed].
BTW: In this case I have the MCU arbitrarily set to P16F15344
BTW2: When I say "main.c" I'm speaking euphemistically -- I really referring to my "BugReport_preProcNoCalc.c" file -- I suppose I shoodda just called it "main.c"!
config.h
Code: Select all
#define SOME_DEFED_VAL 500
Code: Select all
#include "config.h"
const unsigned int SOME_CALC_USING_CONFIG = (unsigned int)(3 * SOME_DEFED_VAL);
void main()
{
while(1)
{
; // Twiddle digits
}
}
If I could add just one more screen shot, I could show you the result of adding a space in the main.com file, then recompiling: The SOME_CALC_USING_CONFIG becomes 1200, which is the correct value.
The Compiler/Linker messages show nothing about compiling the config.h file -- sorry that got covered up.