liaK
liaK

Reputation: 11648

Eclipse indexing not working

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.

Upvotes: 30

Views: 77738

Answers (15)

uss
uss

Reputation: 1309

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

Upvotes: 25

John Doe
John Doe

Reputation: 1

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.

Upvotes: 0

venk
venk

Reputation: 1105

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.

Upvotes: 0

Michal M.
Michal M.

Reputation: 91

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! :)

Upvotes: 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

Upvotes: 0

Shibu J
Shibu J

Reputation: 1

  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.

Upvotes: 2

kapilddit
kapilddit

Reputation: 1769

  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.

Upvotes: 0

Saadat
Saadat

Reputation: 521

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.

Upvotes: 2

user4786271
user4786271

Reputation: 1565

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.

Upvotes: 9

Augusto S&#233;rgio
Augusto S&#233;rgio

Reputation: 3

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.

Upvotes: 0

vr286
vr286

Reputation: 836

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

Upvotes: 1

Flo
Flo

Reputation: 139

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.

Upvotes: 0

paarandika
paarandika

Reputation: 1439

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

Upvotes: 0

dimo414
dimo414

Reputation: 48804

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.

Upvotes: 5

BЈовић
BЈовић

Reputation: 64223

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.

Upvotes: 9

Related Questions