Where does MCUXpresso search for #ifdef's

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Where does MCUXpresso search for #ifdef's

Jump to solution
1,460 Views
aberger
Contributor V

Where does MCUXpresso search for defined symbols in order to evaluate active/inactive code as dictated by #ifdef statements?

I'm aware of the Preprocessor "Defined symbols" list in Project Properties.

e.g.

pastedImage_1.png

However, I think that it must also search source files. For example, I have the following code in a header file, module1.h

pastedImage_2.png

I have not #define'd DEFINE_GLOBALS anywhere in module1.h. I have defined it in module1.c. However, the Project has other source files that #include module1.h, but which do not #define DEFINE_GLOBALS.

So how does the IDE decide where to look for the #define DEFINE_GLOBALS directive, and how does it choose what to highlight as the inactive code?

1 Solution
1,125 Views
BlackNight
NXP Employee
NXP Employee

Eclipse uses a special source file parser which reads the source files and defines. This is independent of the compiler itself you have presen in your tool chain.

That Indexer is configurable, see for example Fixing the Eclipse Index | MCU on Eclipse . Depending on your source files and how you use it, you might disable that heurstic option.

Below are my settings which I'm using for most of my workspaces.

pastedImage_2.png

I hope this helps,

Erich

View solution in original post

1 Reply
1,126 Views
BlackNight
NXP Employee
NXP Employee

Eclipse uses a special source file parser which reads the source files and defines. This is independent of the compiler itself you have presen in your tool chain.

That Indexer is configurable, see for example Fixing the Eclipse Index | MCU on Eclipse . Depending on your source files and how you use it, you might disable that heurstic option.

Below are my settings which I'm using for most of my workspaces.

pastedImage_2.png

I hope this helps,

Erich