One of the greatest features in Eclipse is the Indexer: it parses automatically my code in the background. It creates all the needed information so I can browse around my sources. I can use the Open Declaration context menu in the source code:
Another way is to click into the variable/include/etc and press the F3 key. Or to hold the CTRL key pressed and hover over it with the cursor to hyperlink it:
The Indexer knows as well my macros and grays out things if not active or disabled. But sometimes things simply look wrong: I know that my macro is enabled, but the editor still shows it grayed out?
I’m sure that I have defined PL_HAS_TEMPERATURE in my header file, and I properly have included it. Still eclipse thinks it is not defined or not set to one?
One first thing I try is to rebuild the index. For this I select the project and select the menu Index > Rebuild:
This usually fixes things for me.
If not, then there is a problem with the project or workspace settings for the Indexer: the project settings for the Indexer are accessible in the project properties. The workspace settings are found in Window > Preferences > C/C++ > Indexer:
What I have found out is that ‘Allow heuristic resolution of includes‘ is causing inaccurate results. As in my example above,the indexer is not correctly using the includes if heuristics are enabled. The solutions is to disable heuristics.
The other setting is for the active build configuration: I make sure I have ‘Use active build configuration‘ enabled. That way the Indexer is switching the data base based on the build configuration too.
With these options the result is now correct: