cancel
Showing results for 
Search instead for 
Did you mean: 

Preprocessors sections not accessed after last STM32CubeIDE update

AAl-H
Associate III

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

0693W00000007t1QAA.png

If it's a code inside a function, it's not ok

0693W00000007t7QAA.png

1 ACCEPTED SOLUTION

Accepted Solutions
AAl-H
Associate III

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

View solution in original post

7 REPLIES 7
etheory
Senior

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.

AAl-H
Associate III

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)?

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)?

AAl-H
Associate III

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

AAl-H
Associate III

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

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.

Pavel A.
Evangelist III

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