如何配置Emacs CEDET Semantic与Qt4?

4
我在 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:

/usr/include/qt4/
/usr/include/qt4/QtGui/ 
/usr/include/qt4/QtCore/
/usr/include/c++/4.4/
/usr/include/c++/4.4/x86_64-linux-gnu/
/usr/include/c++/4.4/backward/
/usr/local/include/
/usr/lib/gcc/x86_64-linux-gnu/4.4.3/include/
/usr/lib/gcc/x86_64-linux-gnu/4.4.3/include-fixed/
/usr/include/

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.


鉴于他们没有一个 cedet-users 邮件列表,我建议也尝试 cedet-devel。 (我也在尝试 CEDET 的入门,目前进展不顺) - decimus phostle
1个回答

2
在底部它说:
“似乎这种方法在最新的CEDET中不起作用 - 我正在修复”
然后在评论中他说:
“看来CEDET没有编译正确。请从CVS获取CEDET并根据说明进行编译。”
所以我认为您应该重新编译和构建它,然后它应该可以工作 - 但我没有尝试过。我只是建议这样做,因为那就是文章所说的。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接