我在X86_64-pc-gnu-
linux(ubuntu 10.04)上使用emacs 23.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 ();
}
Unable to find datatype for: “class QPushButton hello ()”.
Declared type is: “class QPushButton {}”
Raw data type is: (“QPushButton” type (:type “class”) nil nil)Semantic could not find this data type in any of its global tables.
Semantic locates datatypes through either the local scope, or the global
typecache.Local Scope Information:
* Tag Class Constraint against SCOPE: (type)
* No known parents in current scope.
* No known symbols currently in scope.
* No known symbols declared locally.
Semantic creates and maintains a type cache for each buffer.
If the type is a global type, then it should appear in they typecache.
To examine the typecache, type:M-x semanticdb-typecache-dump RET [ Do It ]
Current typecache Statistics:
0 types global in this file
0 types from includes.If the datatype is not in the typecache, then your include
path may be incorrect.Include Path Summary:
This file’s project include search is handled by the EDE object:
Buffer Target: #ede-cpp-root-target /home/mike/project/shared/>
Buffer Project: #ede-cpp-root-project Test>
Backup Locator: #ede-locate-base Loc>The system include path is:
06002
Include Summary: /home/mike/project/shared/test-qt-semantic.cpp
test-qt-semantic.cpp contains 3 includes.
Unknown Includes: 0
Unparsed Includes: 0
Parsed Includes: 3
No unknown includes.
最佳答案 它在底部说:
It seems, that this approach will not work in fresh CEDET – I’m working on fix
然后在评论中他说:
It seems, that CEDET wasn’t compiled properly. Please, take CEDET from CVS and compile according instructions
所以我认为你应该再次编译和构建它然后它应该工作 – 但我没有尝试过.我只是建议它,因为这是文章所说的.