2020-03-08 03:48 AM
Hello,
I have some preprocessors defined in my code and they're NOT greyed out
The problem is, the debugger is not accessing them
Every function under the definition is accessed OK.
But if the #if condition is inside the function, the debugger ignores that code
I tried cleaning the project and rebuilding the index but the problem is still there
If it's a function, it's OK
If it's a code inside a function, it's not ok
Solved! Go to Solution.
2020-03-08 05:07 AM
OK, I don't know what the problem is, but I found out how to slove it
main.c is the only file that had a problem
right click on 'main.c' -> Properties-> Restore Default
That seems to have solved it
2020-03-08 04:24 AM
The text editor isn't always accurate.
The full if statement says:
#if defined(SENSERION_CO2) || defined(IR_SENSOR)
If, as you are saying the first function example gets entered, then clearly IR_SENSOR is defined.
However, if SENSERION_CO2 is ALSO defined, and the text editor isn't figuring that out, then that would explain your issue.
I don't think the issue here is what is greyed out, so much as trusting a text editor that might not be able to accurately follow all of your pre-processor definitions.
2020-03-08 04:37 AM
Thank you for your response
SENSERION_CO2 is NOT defined in my code
But shouldn't 1 of these 2 be enough since I'm using (OR)?
2020-03-08 04:38 AM
Thank you for your response
SENSERION_CO2 is NOT defined in my code
But shouldn't 1 of these 2 be enough since I'm using (OR)?
2020-03-08 04:41 AM
I've found something
The problem only happens in main.c
All the other .h and .c files don't have a problem
The line "#define IR_SENSOR" is added in main.h
And the problem is only in main.h code that is related to this line only
In short, main.c is not seeing anything under "#ifdef IR_SENSOR" in main.h
I have other definitions in main.h that main.c has no problem with
I don't know why it has a problem only with this particular definition
2020-03-08 05:07 AM
OK, I don't know what the problem is, but I found out how to slove it
main.c is the only file that had a problem
right click on 'main.c' -> Properties-> Restore Default
That seems to have solved it
2020-03-08 05:17 AM
If either SENSERION_CO2 OR IR_SENSOR was defined (whether in your code, or anywhere else), then the top branch (the one you weren't expecting) would be entered.
2020-03-08 07:32 AM
This is common functionality of Eclipse CDT.
Try to rebuild index (right click on the project, Index-> Rebuild).
Tune the desired behavior of indexing in the workspace settings (or in project settings if you enabled per-project settings).
-- pa