6

I have two c++ source files. I am building each in a separate build configuration. I have set up each build configuration to exclude the other source file. In the Project Explorer, one of the file's icons has a slash through it, showing it as the source file that is excluded and I cannot refactor code for this source file. This is all as expected, done according to the instructions found here.

I have verified that each file has the "Exclude resource from build" box checked for the appropriate build configuration. Furthermore, I have verified that the build command for each build configuration builds the correct source file.

Then I click Project->Build Configurations->Set Active and select the other build configuration but the same source file is excluded. I also tried switching configurations by actually building the different configurations, but again, the file exclusions remain the same (both the icon shows it as deactivated and I cannot refactor that source file).

I have searched various posts but do not see the exact circumstance I'm facing, though this one was close. Perhaps I don't know the correct terminology to do a proper search.

Am I switching between configurations correctly? Is there a workaround for this behavior (besides including all files in the build, if I need to refactor, and then re-excluding them before build)?

I have seen this behavior in Nsight (running Eclipse 3.8) and in Eclipse Mars (4.5.0). I am running on Linux CentOS 6.7, 64-bit.

Community
  • 1
  • 1
MrMas
  • 1,013
  • 2
  • 14
  • 26
  • 3
    Ok -- I found it. Window->Preferences->Indexer->Build configuration for the indexer->Use active build configuration (http://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.cdt.doc.user%2Freference%2Fcdt_u_indexer_preference.html). – MrMas Aug 31 '15 at 18:31
  • 1
    have no clue what indexer is, hate that it is not selected by default. And love your question and self answer. I only miss that I can not give more than +1. some answers shall be +3 at least... – Vit Bernatik Jan 08 '16 at 13:45
  • @VitBernatik made my comment a response since it appears to be the correct fix. – MrMas Jan 11 '16 at 19:12

1 Answers1

12

In Window->Preferences->Indexer, select "Use active build configuration" (help.eclipse.org/mars/…) in the frame titled "Build configuration for the indexer".

MrMas
  • 1,013
  • 2
  • 14
  • 26