Conditional Highlighting and Multiple Configurations

OK, so my project now has multiple Configurations.

The Configurations define various symbols to control conditional compilation; eg,

#ifdef CONFIG_A
// Config-A stuff

#ifdef CONFIG_B
// Config-B stuff

#ifdef CONFIG_C
// Config-C stuff

When I had only 1 Configuration, M2MStudio would correctly grey-out the disabled sections; but that doesn’t work any more with the multiple configurations - what have I missed?

This is related to the indexer settings.
Please go to your project properties > C/C++ General > Indexer page.
You normally gets something like this:

But sometimes, a bug makes the indexer fixed on a build configuration (it’s actually the workspace default configuration). In this case, you just have to check the “project specific settings” box, and tell the indexer to always use the active build configuration.

What’s the significance of the ‘Store settings with project’ checkbox?

Where are the settings stored if I don’t check this (as shown in your screenshot)?

The conditional compilation highlighting now seems to be working, but all the rest of the indexing is now broken!

Even if I go back to that dialogue, and “Restore defaults”!


If I select any symbol now, and press F3, I just get, "Could not find symbol in index’

Index > Rebuild appears to do nothing - as do all the other entries on the 'Index/ menu!


What’s gone wrong now??

It controls the storage location of the indexer settings:

  • either in the project’s data (.cproject file)
  • or in the workspace

The first option sounds better, since otherwise, settings are lost when you share the project with others, for example. We will take care of making this the default in a future release.

As for other things, the CDT indexer seems sometimes to be completely confused :confused:
When it occurs, I’ve no precise tip to making it working again, but you can try the following suggestions:

  • Make sure that the indexer is configured on the active build config, and save settings with the project.
  • Try to rebuild the index (despite sometimes it indeed doesn’t work, sometimes it does, hopefully)
  • Try to close/reopen the project, and to rebuild the index if it’s not enough.
  • Try to close/reopen M2M Studio, and to rebuild the index if it’s not enough.

I never had a project where the indexer if completely broken whatever I did, only some cases where it was temporarily broken.

What should I see to confirm that the index is actually being built - something in the status bar? the Console view?

At the moment, it just seems to be entirely ignoring the request!

Actually, each time the indexer runs, it should print an information log entry in the Error Log view (saying how many files it has indexed, etc etc…)

It seems that this is still the case in Developer Studio 1.2.0 - yes :question:

I had added a new Build Configuration, and the index was not working.

I did [1], then [2] did nothing and then [3] got it working again. :slight_smile:

No improvements on that side from CDT team, indeed.
Next big CDT milestone is planned for June, with a deep refactoring of the build configurations system. We’ll keep a eye on the indexer subject, hoping all that weird behaviours will be fixed.

So; is this a general Eclipse issue - not specific to DS?

Yes, it is…