score:82

Accepted answer

right-click on your project, go under the index submenu, and choose either "rebuild," "update with modified files," or "freshen all files."

i don't know the difference between those three options, but one of "update with modified files" or "freshen all files" usually fixes it for me.

also, i'm sure you've already done this, but make sure that you're running the latest version of the eclipse cdt. current versions seem to have much more reliable indexing than previous versions.

score:0

i started with trying josh kelleys and mmmmms answers without any luck, but i finally fixed it by checking my include paths.

one way to see them are in the project explorer, expand project and there should be an entry "includes". inside that, check for a small yellow warning triangle on each include path. if that triangle is present eclipse most likely doesn't recognize the path.

the include paths are edited through right-clicking on "your project" in the project explorer, then choose "properties" --> c/c++ general --> paths and symbols --> includes.

i see three language options, assembly, gnu c, gnu c++. choose the correct one before starting to add paths (likely gnu c++). after adding all the paths, -->apply --> ok and rebuild index if you're asked to.

my erroneous workspace paths looked like myproject/myproject/folder when it was supposed to be myproject/folder.

for me the "problems"-view is always slow to update, even after rebuilding index. to be sure that the error is still there, double-click the problems entry so that eclipse opens/reloads the file in question. this often seems necessary for me to update the "problems" view.

i don't really know if it was eclipse or my scm that messed it up. anyway, hope it helps someone!

i use luna and builds with an external makefile.

score:1

did you try adding -clean to the command line for the eclipse executable?

score:1

eclipse no longer treats your project as a c++ project. choose menu file/new/convert to a c/c++ project. it takes a while to index the source code. worked for me

score:2

i found that i had the global indexer set to 'use the build configuration specified in the project's indexer settings', and the project's indexer set to not use project specific indexer settings. regardless, it was using the same fixed configuration for the indexer regardless of which configuration i had selected. the fix: window-preferences, c/c++, indexer. select "use active build configuration" in section "build configuration for the indexer".

happy days.

score:6

delete only the .pdom file under .metadata.plugins\org.eclipse.cdt.core helps, i got the indexer screwed after upgrading neon.2 to neon.3 and this seems to solve the problem. (this comment already exists above but am not allowed to confirm it up there).

score:17

neither of the above worked for me (eclipse indigo), index still broken and refusing to rebuild properly. until applied this one:

http://slsam2.blogspot.com/2012/02/eclipse-cdt-index-not-working.html

the crucial bit of the linked post is this:

eclipse no longer treats your project as a c++ project. choose menu file/new/convert to a c/c++ project. it takes a while to index the source code.

i still wonder how eclipse can uncontrollably shoot itself in the foot like that. i suspect that installing additional packages can trigger it. perhaps javascript support in my case.

score:21

go to your project properties -> c++ general -> indexer.

  • do this with 'project specific settings',
    (or on 'configure workspace settings...').
  • deselect 'enable indexer' hit apply.
  • select 'enable indexer' hit apply.

this should completely wipe out and rebuild the index.

score:36

from http://dev.eclipse.org/mhonarc/lists/cdt-dev/msg10390.html, the differences between "rebuild," "update with modified files," or "freshen all files":

rebuild: works for entire projects, only. clears the index and indexes the files from scratch. when cancelled it leaves you with an empty or partial index.

update with modified files: works on a resource selection. checks on individual files whether the timestamp or the scanner-config has been changed and updates the index for the changed files.

freshen all files: works on a resource selection. updates the selected files in the index. the index is not cleared, it is safe to cancel the operation.


Related Query

More Query from same tag