Where does MCUXpresso search for #ifdef's

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Where does MCUXpresso search for #ifdef's

跳至解决方案
1,828 次查看
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 解答
1,493 次查看
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

在原帖中查看解决方案

1 回复
1,494 次查看
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