31

I am using CDT in Eclipse 3.5.2 Galileo in Ubuntu.

My eclipse's indexer doesn't work at times. By that I mean when I ctrl click a function it says Could not find symbol in index. Also, F3 button click results in the same error message. Actually most of the places it is not working and works in very few places.

I have seen some other versions of Eclipse where under File menu a menu item listed for Indexing. Like File->Indexer->Rebuild.... But in my File menu there is no such menu item for the Indexer.

Will the only way be to use some other release of Eclipse or am missing something? Any pointers regarding this would be helpful.

2
  • Possible duplicate of Clean Eclipse Index, it is out of sync with code Commented Mar 9, 2017 at 6:31
  • Indexing was not working for me as I created a new project but not a C/C++ project. I deleted it. I created an "existing makefile project (C/C++)" in a new folder. Then created a new folder within Eclipse and linked the source code to it. Indexing is now working. I don't want to create the Eclipse project directly in the source code as it is managed by git and it will impact the .cproject files. Commented May 27, 2020 at 13:29

16 Answers 16

25

In my case nothing has worked and at last I did the following:

  1. Close the project
  2. Delete the project(do not check from disk option)
  3. create new project with existing code(use the deleted project path)
  4. Successfully indexed my c++ code
Sign up to request clarification or add additional context in comments.

2 Comments

Import the project as Makefile project.
Thanks, anyway, it seems there is no need to delete the project, just close, and with a CMake project it seems I needed to run cmake . before reopening project.
9

To add paths containing code to parse, follow these steps :
1. Right click on the project
2. Select Properties
3. Go to C/C++ General
4. Go to Path and Symbols
5. If the paths are missing, add paths.

To re-parse the code follow these steps :
1. Right click on the project
2. Select Index
3. Rebuild

If this doesn't work, then you are out of luck. c++ is very difficult language to parse.

Comments

9

If your indexer is stuck and it hangs for infinite time, you can delete the indexer related files of your project from .metadata. Make sure eclipse is not running in the meanwhile.

The .metadata directory is located as a hidden folder in the path of your workspace.

There you can navigate to:

<workspace_path>/.metadata/.plugins/org.eclipse.core.runtime/.settings/

Inside the .settings/ directory there are .prefs files which store the preferences of each project individually.

For example: org.eclipse.cdt.core.prj-test-project.prefs stores the preferences of the project test-project

Open this file with the text editor and remove all the lines starting with indexer. This will reset the indexer settings for this specific project to the default.

Alternatively, you can remove all the lines starting with indexer from org.eclipse.cdt.core.prefs; doing this will reset the indexer settings for the whole workspace.

1 Comment

After following these steps, I just had to Index -> Rebuild and voilà!
5

I believe you can clear the index by running:

rm .metadata/.plugins/org.eclipse.jdt.core/*.index 

And then restarting Eclipse. It will then rebuild its index.

This worked for me in a Java project, but I imagine its the same index for all (most?) project types.

Comments

2

For me this worked:

  • Right click and close the project
  • Open the project again
  • Right click and select Index->Rebuild

I hope it helps anybody.

Comments

2
  1. Right click on the project.
  2. Select New->Convert to a C++ Project. Select your configuration. And then Next
  3. Indexer will start indexing all the files.

Comments

1

Convert a project to C or C++ nature:

Right click on project: New >  Convert to C/C++ Project

In "Convert to C or C++": Choose C/C++ Project

In "Project options": Check "Specify Project Type"

...Project Type: Choose "Makefile project"

...Toolchains: Gross GCC

1 Comment

This worked for me, the indexer started working immediately after the conversion. But for another project it worked by just adding the natures manually: Right clikc the project -> Properties -> Project Natures Tab -> Add... -> C Nature and C++ Nature.
0

You can try rebuilding the index. Right-click on the project in Project View. Then Index -> Rebuild.

Comments

0

Here is the solution I used after Project->C++ Index->Rebuild failed. This trick avoid deleting your current project :

1) Copy the current project (Right click->Copy from Project Explorer) 2) Paste it (Right click->Paste from Project Explorer) and give the copy another name 3) The indexer should now start and index both projects 4) When indexation is complete, you can delete the copy 

PS: Make sure your original project is an actual C++ Project or this will obviously not work.

Comments

0

I was having the same problem and it turns out that the index folder was owned by root (I must have run Eclipse as a root once for some reason) I reclaimed the project folder using sudo chown -R username projectfolderpath and problem solved.

Comments

0
  1. Execute eclipse.exe -clean -refresh where the eclipse is installed.
  2. Create a new C/C++ Project in Eclipse with Given Source code folder path. (Not with New Project based on existing workspace)

Above steps worked for me.

Comments

0

For me it was issue that when creating a project indexer was chosen as none. Deleted the project and while creating the project again I chose the indexer options as per my need "LINUX_GCC", then it worked for me

Comments

0

Just came across the same problem in my C++ ARM Cross GCC project. I'm developing on Windows, using Makefile and an Ubuntu Docker image with GNU ARM Embedded Toolchain to build the project.

The solution to get rid of the unresolved symbols, in my case, could be divided into two parts:


  1. The CDT Arm Cross GCC Built-in Compiler Settings didn't have the path to the compiler.

In the Project Properties -> C/C++ General -> Preprocessor Include Paths -> Providers(tab) the path to the compiler must be provided.

Using the GNU ARM Embedded Toolchain, the entry for the Command to get compiler specs: I currently use is:

C:\GNU_Arm_Embedded_Toolchain\9-2020-q2-update\bin\arm-none-eabi-g++.exe ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD "${INPUTS}" 

CDT Arm Cross GCC Built-in Compiler Settings

Note: Yes, I am having installed the same toolchain on my Windows machine as I'm using in the Docker image.

To verify, that the call is correct, you can tick the Allocate console in the Console View, which will provide hlepful output to the Console. Also, in the Entries tab, when you unroll the CDT Arm Cross GCC Built-in Compiler Settings you should see the includes and symbols included.


  1. Missing symbol in the Project Properties -> C/C++ General -> Paths and Symbols menu.

As I have my defines in the Makefile, I forgot to add the define of my MCU also here.


Hope this helps to someone! :)

Comments

0

For the most part, the other answers tackle the situation wherein one "had" a working index earlier and things have gone astray for some reason. On the other hand, I faced a problem wherein I needed to install everything from scratch (eclipse, workspace, c++ project etc.) and the indexing just wouldn't work. I finally found the solution here: https://www.eclipse.org/forums/index.php/t/1109004/

The key inputs from the above page are:

You need to setup include paths for the Indexer just as you would need to for the compiler. The Indexer and compiler are completely independent.

The Indexer include paths are set by

Project -->Properties --> C/C++ General --> Preprocessor Include Paths, Macros etc. --> Entries tab --> CDT UserSettings Entries ... 

and

You could try using

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

That's supposed to merge telling the compiler and Indexer in one place.

However, this latter part of the suggestion did not work for me.

Comments

0

These workarounds here mostly don't work anyway for correct project. I had the same problem but with stm32 c project. Everything was totally fine probably until excessive switching between commits. I was sure my paths were totally fine. Other advices from this thread didn't do anything. What helped me was going into properities > c/c++ general > indexer and enabling "project specific settings" and then setting almost everything to on. Started to work immediately.

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
0

Analysis in 2025

The Indexer still is not robust.

The Index is a per project file database, while it doesn't meet the basic database requirement to have a consistent persistent version at any time.

When such index file becomes corrupt, the Indexer function Rebuild in many cases is not able to simply throw away an inconsistent old version, start from zero and perform a consistent rebuild, as it should.

Known reasons for an index file to become corrupt are

  1. Lack of Memory

  2. Connection to a virtual drive with transient lease containing the workspace is lost

The Indexer does not report any of these.

Approaches

  1. Delete related indexer files and rebuild the index.
    Indexer files are

    .metadata/.plugins/org.eclipse.cdt.core/<project>.<n>.pdom 

    inside the workspace folder.

  2. If first approach does not succeed, the Indexer might be a memory problem.
    The default memory settings in the eclipse configuration file eclipse.ini might be
    -Xms256m
    -Xmx2048m

    You may increase both values by e.g. 100m and repeat approach 1. after restarting eclipse.

This is the summary from related question What do I do when the Eclipse CDT indexer gets stuck?.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.