Eclipse CDT 索引无法在项目中查找声明
我已经安装了 Eclipse &新安装的 Ubuntu 上的 CDT 插件。索引设置为推荐的“快速索引”(“完整索引”似乎有边际差异)。
在很多地方,如果我在任何类
名称或包含文件名上按'F3'
('显示声明'),光标将保持静止状态,并且不会导致声明。但是,它适用于标准文件和符号,例如 stdio.h
、std::vector
等。
例如,我有 2 个文件,
/home/myself/Workspace/Project/X/Y/include/file.h
/home/myself/Workspace/Project/X/src/file.cpp
我无法看到驻留在 file.h 内的
。即使在 file.cpp
中显示的任何 class
或变量的任何声明#include"file.h"
上按 'F3'
,我也无法转到 file.h
。
Eclipse Workspace 在 Workspace
文件夹中创建,C++ 项目在 Project
文件夹中创建。为了存储包含路径,我在 Eclipse 中遵循了以下过程:
Project ->属性-> C/C++ 通用 ->路径和符号 ->库和路径 ->添加“/Project/X/Y/include/file.h”(使用“工作空间”和“文件系统”选项卡)
但仍然没有运气。我在互联网上做了足够的搜索,但找不到任何有用的东西。请注意,我现在仅使用 Eclipse 进行代码浏览,而不是用于构建代码。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,可以使用了。实际上,我在
路径和符号
中包含的任何包含路径都是多余的,并且它们没有区别,因为工作区/项目
下的所有内容都将被索引。该解决方案非常奇怪,它与可扩展性有关,这是我从此链接。在 Eclipse 中转到,
设置一个巨大的数字,例如
500000
,然后按“确定”。问题解决了!对于我的情况,实际设置值为5000
,我看到的源文件有16k+
行。Ok, got it working. Actually whatever include paths I have included in
Paths and Symbols
are redundant and they make no difference as everything underWorkspace/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,
Set a huge number such as
500000
and press "OK". The problem was solved! For my case the actual set value was5000
and the source file I was seeing was of16k+
lines.