我将CEDET配置为自动完成MinGW的gcc,它工作得很好,但是我不能得到g++的工作,以完成STL库的成员。例如,我无法自动完成std::string变量以获取c_str()或其他函数:
#include <string>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
string s;
s. // no pop up member functions here
return 0;
}下面是我的.emacs的配置部分:
;; setting up for semantic-mode
(semantic-mode 1)
(require 'semantic/bovine/c)
(setq MinGW-64-base-dir
"D:/MinGW/x86_64-w64-mingw32/include")
(add-to-list 'semantic-lex-c-preprocessor-symbol-file
(concat MinGW-64-base-dir "/crtdefs.h"))
(add-to-list 'semantic-lex-c-preprocessor-symbol-file
(concat MinGW-64-base-dir "/yvals.h"))
(add-to-list 'semantic-lex-c-preprocessor-symbol-file
(concat MinGW-64-base-dir "/vadefs.h"))
(add-to-list 'semantic-lex-c-preprocessor-symbol-file
(concat MinGW-64-base-dir "/comdefsp.h"))
(semantic-c-reset-preprocessor-symbol-map)
(defconst user-include-dirs
(list ".." "../include" "../inc" "../common" "../public"
"../.." "../../include" "../../inc" "../../common" "../../public"))
(defconst win32-include-dirs
(list "D:/MinGW/include"
"D:/MinGW/x86_64-w64-mingw32/include"
"D:/MinGW/lib/gcc/x86_64-w64-mingw32/4.7.2/include"
"D:/MinGW/lib/gcc/x86_64-w64-mingw32/4.7.2/include/c++"
"D:/MinGW/lib/gcc/x86_64-w64-mingw32/4.7.2/include-fixed"
))
(let ((include-dirs user-include-dirs))
(when (eq system-type 'windows-nt)
(setq include-dirs (append include-dirs win32-include-dirs)))
(mapc (lambda (dir)
(semantic-add-system-include dir 'c++-mode)
(semantic-add-system-include dir 'c-mode))
include-dirs))我的配置有问题吗?需要为MinGW g++配置正确的配置。
发布于 2013-03-20 08:02:16
我在我的Ubuntu系统上测试了你的样例,没有你的配置,它提供了更多的完成,我不知道该怎么做。我猜语义不知道某些包含文件在哪里,或者没有设置正确的预处理器符号。
如果您这样做了:
M-x load-library RET semantic/analyze/debug RET然后,您可以将光标放在样本上并执行以下操作:
M-x semantic-analyze-debug-assist RET它将为您提供一系列提示,以及尝试挖掘问题的其他命令。
我知道您在设置中设置了所有的包含和预处理器文件。这部分对我来说似乎没问题。
semantic/bovine/gcc.el中的代码应该向您的GCC查询您提供的信息类型,这些信息用于查找STL标头之类的内容。编译器提供了STL标头使用的某些类型的#define值,并且可能不在您为预处理器符号提供的其他ming标头中。
不幸的是,对于它试图使用的C++编译器,它有硬编码的名称。如果您的编译器有其他名称,您可能需要编辑gcc.el源文件才能使其工作。如果您这样做了,请发送电子邮件到cedet-devel邮件列表,这样我们就可以在CEDET中进行更改。
或者,加载您的string.h .h文件所在的位置,并找到它应该用来完成的定义。查看哪些#if语句将其过滤掉,然后使用:
M-x语义-c-描述-环境RET
来看看这两者之间有什么联系。
https://stackoverflow.com/questions/15492419
复制相似问题