Reputation: 11648
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
Reputation: 1309
In my case nothing has worked and at last I did the following:
Upvotes: 25
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
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
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:
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}"
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.
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
Reputation: 1
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
Reputation: 1
New->Convert
to a C++
Project.
Select your configuration. And then NextUpvotes: 2
Reputation: 1769
Above steps worked for me.
Upvotes: 0
Reputation: 521
For me this worked:
I hope it helps anybody.
Upvotes: 2
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
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
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
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
Reputation: 1439
You can try rebuilding the index.
Right-click on the project in Project View. Then Index -> Rebuild
.
Upvotes: 0
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
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