Wednesday 22 February 2012

Eclipse CDT: index not working

Eclipse CDT indexing of source codes is very important for large projects. Without it you cannot highlight a class or function and right click "open declaration". Manually go through the source tree to find a file is a nightmare.

The index of my C++ project was suddenly broken. I cannot highlight a class member and right click "open declaration". Also when I edit a header file, the outline panel does not show the class members.

I find this link
http://wiki.eclipse.org/CDT/User/FAQ#Why_does_Open_Declaration_.28F3.29_not_work.3F_.28also_applies_to_other_functions_using_the_indexer.29
but it does not work for me.

Then it occurs to me Eclipse no longer treated my project as a C++ project. Finally I got a solution:

Choose menu File/New/Convert to a C/C++ project. It took a while to index the source code. After that, everything works like a charm.


6 comments:

  1. Thanks, you saved my day. None of the common index rebuilding techniques helped.

    ReplyDelete
    Replies
    1. Yepp me too. I've some how corrupted my workspace and this solution has worked for me!
      Thank you Sam Liu!

      Delete
  2. Worked for me as well. Thanks.

    ReplyDelete
  3. Works! Thanks

    ReplyDelete