How can I convince Eclipse CDT that a macro is defined for source code editing and code completion?

In addition to Oswald’s answer:

If you have several build configurations, the default behavior of the Eclipse Indexer seem to be that it always uses the first build configuration.

In my case the define was only defined in the 3rd build configuration, so the solution provided by Oswald did not help.

To change this globally, select Window -> Preferences -> C/C++ -> Indexer.
Choose Use active build configuration

You could also choose to override the global settings in the project settings under Project -> Properties -> C/C++ General -> Indexer and select Enable project specific settings followed by selecting Use active build configuration.

After this, the solution provided by Oswald should work:

Project -> Properties -> C/C++ General -> Paths and Symbols

Choose the Symbols tab and Add… a new Symbol with Name I_WANT_THIS_FEATURE and a Value of 1.

Leave a Comment