我在X86_64-pc-gnu-linux (ubuntu10.04)上使用emacs23.1.1,并按照著名的链接http://alexott.net/en/writings/emacs-devenv/EmacsCedet.html向.emacs添加所有配置。但它甚至不能做基本的工作。我的设置或结构一定有问题。
如果我试图让它显示成员函数,它就找不到。自动完成使用clang作为解析器。那么解析器语义使用了什么呢?
;; Load CEDET
(load-file "~/backup/cedet-trunk/common/cedet.el")
(global-ede-mode 1)
;(semantic-load-enable-code-helpers)
(semantic-load-enable-excessive-code-helpers)
;(semantic-load-enable-semantic-debugging-helpers)
(global-srecode-minor-mode 1)
(global-semantic-tag-folding-mode 1)
(require 'semantic-tag-folding)
(global-semantic-idle-scheduler-mode 1)
(global-semantic-idle-completions-mode 1)
(global-semantic-idle-summary-mode 1)
(global-semantic-idle-completions-mode)
(require 'semantic-ia)
(require 'eassist)
(require 'semantic-gcc)
(require 'semanticdb-global)
(semanticdb-enable-gnu-global-databases 'c-mode)
(semanticdb-enable-gnu-global-databases 'c++-mode)
(setq qt4-base-dir "/usr/include/qt4")
(setq qt4-gui-dir (concat qt4-base-dir "/QtGui"))
(setq qt4-core-dir (concat qt4-base-dir "/QtCore"))
(semantic-add-system-include qt4-base-dir 'c++-mode)
(semantic-add-system-include qt4-gui-dir 'c++-mode)
(semantic-add-system-include qt4-core-dir 'c++-mode)
(add-to-list 'auto-mode-alist (cons qt4-base-dir 'c++-mode))
(add-to-list 'semantic-lex-c-preprocessor-symbol-file (concat qt4-base-dir
"/Qt/qconfig.h"))
(add-to-list 'semantic-lex-c-preprocessor-symbol-file (concat qt4-base-dir "/Qt/qconfig-large.h"))
(add-to-list 'semantic-lex-c-preprocessor-symbol-file (concat qt4-base-dir "/Qt/qglobal.h"))
(defun my-cedet-hook ()
(local-set-key [(control return)] 'semantic-ia-complete-symbol-menu)
(local-set-key "\C-c?" 'semantic-ia-complete-symbol)
(local-set-key "\C-c>" 'semantic-complete-analyze-inline)
(local-set-key "\C-c=" 'semantic-decoration-include-visit)
(local-set-key "\C-cj" 'semantic-ia-fast-jump)
(local-set-key "\C-cb" 'semantic-mrub-switch-tags)
(local-set-key "\C-cd" 'semantic-ia-show-doc)
(local-set-key "\C-cs" 'semantic-ia-show-summary)
(local-set-key "\C-cp" 'semantic-analyze-proto-impl-toggle)
(local-set-key "\C-cr" 'semantic-symref)
(local-set-key "\C-c\-" 'senator-fold-tag)
(local-set-key "\C-c\+" 'senator-unfold-tag)
)
(add-hook 'c-mode-common-hook 'my-cedet-hook)
(add-hook 'lisp-mode-hook 'my-cedet-hook)
(add-hook 'emacs-lisp-mode-hook 'my-cedet-hook)
(ede-cpp-root-project "Test"
:name "Test Project"
:file "~/project/shared/test-qt-semantic.cpp"
:include-path '("/"
)
:system-include-path '("/usr/include/qt4"
"/usr/include/qt4/Qt"
"/usr/include/qt4/QtGui"
"/usr/include/qt4/QtCore"
))这是源文件:
#include <QApplication>
#include <QPushButton>
#include <QString>
int main (int argc, char ** argv)
{
QApplication app (argc, argv);
QPushButton hello ("Hello, World!");
hello.resize (100, 30);
hello.show ();
QString id("hi");
return app.exec ();
} 无法找到“类QPushButton hello ()”的数据类型。 声明的类型是:"class QPushButton {}“ 原始数据类型是:("QPushButton“类型(:类型为"class")零) 语义无法在其任何全局表中找到此数据类型。 Semantic通过本地范围或全局类型缓存来定位数据类型。 本地范围信息: *对作用域的标记类约束:(类型) *目前范围内没有为人所知的父母。 *目前范围内没有已知的符号。 *没有在当地宣布的已知符号。 Semantic为每个缓冲区创建并维护一个类型缓存。 如果该类型是全局类型,那么它应该出现在它们的类型缓存中。 要检查类型缓存,输入: M语义数据库-类型缓存-转储RET 当前的类型缓存统计: 0在此文件中键入全局类型。 0类型从包含。 如果数据类型不在类型缓存中,则包含路径可能不正确。包括路径摘要: 此文件的项目包含搜索由EDE对象处理: 缓冲区目标:#ede root-target /home/mike/project/shared/> 缓冲项目:#ede根项目Test> 备份定位器:#ede-Locator base Loc>系统包括路径为: /usr/include/qt4 4//usr/include/QtGui/usr/include/qt4 4/QtCore/ /usr/include/c++/4.4 / usr/include/c++/4.4/x86_64-linux-gnu/ /usr/include/c++4.4/local/usr/local/usr/lib/gcc/x8664-linux-gnu/4.4.3/include/usr/lib/x86_64-linux-gnu/4.4.3包括-固定//usr/包括/ 包括摘要: /home/mike/project/shared/test-qt-semantic.cpp test包含3个包含。 未知包括:0 未解析的包括:0 分析包括:3 没有未知的包括。
发布于 2012-09-24 15:54:28
在底部写着:
看来,这种方法在新的CEDET中行不通--我正在做修复工作。
然后在评论中他说:
似乎,CEDET没有被正确编译。请从CVS中提取CEDET并按照说明进行编译。
因此,我认为您应该重新编译和构建它,然后它应该能够工作--但我还没有尝试过。我建议这样做只是因为这篇文章是这么说的。
https://stackoverflow.com/questions/11796744
复制相似问题