Eclipse CDT indexing not working to find declarations within the project

iammilind picture iammilind · Jan 31, 2012 · Viewed 18.8k times · Source

I have installed Eclipse & CDT plugin on newly installed Ubuntu. The indexing is set to "Fast indexing" which is recommended ("Full Indexing" seems to have marginal difference).

At so many places, if I press 'F3' ('show declaration') on any class name or include file name, the cursor remains stand still and it doesn't lead to the declaration. However, it works for standard files and symbols like, stdio.h, std::vector and so on.

For example, I have 2 files,

/home/myself/Workspace/Project/X/Y/include/file.h
/home/myself/Workspace/Project/X/src/file.cpp

I am not able to see any declaration of any class or variables displayed in file.cpp which are residing inside file.h. Even pressing 'F3' on #include"file.h", I am not able to go to file.h.

Eclipse Workspace is created at Workspace folder the C++ project is created at Project folder. To store the include path, I have followed this procedure in Eclipse:

Project -> Properties -> C/C++ General -> Paths and Symbols -> Library and Paths -> Add "/Project/X/Y/include/file.h" (used 'Workspace' and 'FileSystem' tabs both)

But still no luck. I have done enough searching on internet and SO, but couldn't find anything useful. Note that, I am using eclipse only for code browsing and not for building the code as of now.

Answer

iammilind picture iammilind · Jan 31, 2012

Ok, got it working. Actually whatever include paths I have included in Paths and Symbols are redundant and they make no difference as everything under Workspace/Project will be indexed.

The solution is very weird and it's related to scalability, which I came to know from this link. In Eclipse go to,

Window -> Preferences -> C/C++ -> Editor -> Scalability -> "Enable scalability mode when ..."

Set a huge number such as 500000 and press "OK". The problem was solved! For my case the actual set value was 5000 and the source file I was seeing was of 16k+ lines.