emacs cedet 语义与 Qt4 如何配置

标签 emacs emacs23 cedet

我在 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.

最佳答案

那么在底部它说:

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



所以我认为你应该重新编译并构建它,然后它应该可以工作 - 但我还没有尝试过。我只是建议它,因为那是文章所说的。

关于emacs cedet 语义与 Qt4 如何配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11796744/

相关文章:

ubuntu - Ubuntu升级到13.10,Emacs升级到24.3.1后,Emacs无法输入日文和中文

emacs - 如何从 Eval : in . dir-local.el 设置缓冲区局部变量?

emacs - 如何让emacs Semantic使用GTAGS生成的TAG文件

emacs - 如何在 emacs 中突出显示 #ifdef <code/> #endif?

c++ - 尝试使用 CEDET/EDE 设置 C++ 项目

emacs - 如何向 Emacs 字体添加 1 像素的垂直间距?

emacs - Boustrophedon 文本编辑?

emacs - 如何在 Emacs 中识别缓冲区的所有者/创建者

Emacs 23 和 Emacs 24 之间的 Emacs 键绑定(bind)更改

emacs - 如何使我的自定义 emacs 加载速度更快?