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:
Happy Indexing






Pingback: Eclipse Editor Scalability | MCU on Eclipse
Pingback: Compiler Defines and Eclipse Editor Highlighting | MCU on Eclipse
Pingback: Top 10 Customization of Eclipse Settings | MCU on Eclipse
Nice, that didn’t solve my problem but it pointed me in the right direction. I was seeing a lot of my symbols not showing up as being indexed. Some of my class types would be green and some would stay black.
Solution:
Increase the Cache Limits in the same window as listed in the article. We have a rather large C++ project that was exceeding the cache limit.
ah, that might explain a similar problem I had: I used to rebuild the index to solve it. I have many projects in my workspace, some with shared folders and linked files. It looks like increasing the cache limits solved that problem