Emacs CEDET 语义补全“无法找到...的类型”
因此,在我转向 emacs 的过程中,我发现很难放弃 Visual Studio 2010 for C++。尝试为 emacs 设置 cedet 并没有让它变得更容易。因此,我使用了 Alex Ott 的温和介绍,我的 init 文件看起来与提供的类似:
(load-file "~/.emacs.d/plugins/cedet/common/cedet.el")
(global-ede-mode 1)
(semantic-load-enable-excessive-code-helpers)
(require 'semanticdb)
(global-semanticdb-minor-mode 1)
(setq semantic-ectag-program "C:/devel/ctags/ctags58/ctags.exe")
(semantic-load-enable-secondary-exuberent-ctags-support)
(require 'semantic-ia)
(require 'semantic-gcc)
(setq-mode-local c-mode semanticdb-find-default-throttle
'(local unloaded system recursive))
(ede-enable-generic-projects)
(global-srecode-minor-mode 1)
一切都很好,但当我尝试打开一个 cpp 文件,该文件在同一目录中具有标头(array_loader.h)并尝试执行以下操作时: register_reader() 方法的代码完成:
array_loader al; al.register_reader();
我得到“找不到'array_loader al'的类型”。矛盾的是,自动完成模式可以无缝运行。他们干涉吗?
我刚刚使用 bazaar 查看了 1.1 beta,然后对其进行了字节编译。我没有设置项目,因为我的所有项目都是基于 cmake 的,并且它们没有包含文件的单个路径。我的项目的每个子库的标题都位于同一目录中。有没有办法解析 CMakeLists.txt 并将该信息提供给 ede 或语义?即使没有这个基本示例也应该可以工作。我做错了什么吗?
So in my process of switching to emacs I find it very difficult to forgo Visual Studio 2010 for C++. Trying to setup cedet for emacs didn't make it any easier. So I used the gentle introduction by Alex Ott and my init file looks similar to the one provided :
(load-file "~/.emacs.d/plugins/cedet/common/cedet.el")
(global-ede-mode 1)
(semantic-load-enable-excessive-code-helpers)
(require 'semanticdb)
(global-semanticdb-minor-mode 1)
(setq semantic-ectag-program "C:/devel/ctags/ctags58/ctags.exe")
(semantic-load-enable-secondary-exuberent-ctags-support)
(require 'semantic-ia)
(require 'semantic-gcc)
(setq-mode-local c-mode semanticdb-find-default-throttle
'(local unloaded system recursive))
(ede-enable-generic-projects)
(global-srecode-minor-mode 1)
All good and dandy but when I try to open a cpp file which has a header (array_loader.h) in the same directory and try to do code completion for the register_reader() method:
array_loader al; al.register_reader();
I get "cannot find types for 'array_loader al' ". Paradoxically, auto-complete-mode works seamlessly. Do they interfere?
I just checked out 1.1 beta using bazaar and then byte compiled it. I didn't setup a project because all my projects are cmake based and they don't have a single path for include files. each sub-library of my project has the headers in the same directory. Is there a way to parse a CMakeLists.txt and feed that information to ede or semantic? Even if there wasn't this basic example should work. Am I doing something wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,万一有人再次遇到这个问题,我设法通过设置我的 cedet 初始化文件来解决它,如 Alex Ott 所示:
https://github.com/alexott/emacs-configs/blob/master/rc/emacs-rc-cedet.el
另外我定义了我的 cmake 项目并使用递归查找来浏览我的 cmake 项目文件夹以查找标头。
仍然奇怪的是,项目外部的 cpp 文件如何找不到类/方法的签名,尽管它们是在同一文件夹中找到的标头中定义的。 semancdb 节流阀设置如下
Well in case anyone has this problem again, I managed to solve it by setting up my cedet init files as indicated by Alex Ott:
https://github.com/alexott/emacs-configs/blob/master/rc/emacs-rc-cedet.el
Also I defined my cmake project and used the recursive find to go through my cmake project folders to find the headers.
It is still strange how cpp files external to the project could not find the signature of the classes/methods although they were defined in headers found in the same folder. the semanticcdb throttle was set as follows