I am new to emacs and i was try to use cedit for code completion. I use a simple setting based on http://alexott.net/en/writings/emacs-devenv/EmacsCedet.html
The .emacs looks like this:
;; cedit
(semantic-mode 1)
(require 'semantic/ia)
(require 'semantic/bovine/gcc)
;;(require 'semantic/bovine/clang)
;;(semantic-clang-active)
(setq-mode-local c-mode semanticdb-find-default-throttle
'(project unloaded system recursive))
;;(semantic-idle-summary-mode )
;; if you want to enable support for gnu global
(semanticdb-enable-gnu-global-databases 'c-mode)
(semanticdb-enable-gnu-global-databases 'c++-mode)
;;(semantic-reset-system-include 'c-mode)
;;(semantic-reset-system-include 'c++-mode)
(defun my-c-mode-cedet-hook ()
(local-set-key "." 'semantic-complete-self-insert)
(local-set-key ">" 'semantic-complete-self-insert))
(add-hook 'c-mode-common-hook 'my-c-mode-cedet-hook)
(add-hook 'c++-mode-common-hook 'my-c-mode-cedet-hook)
(defun my-c-mode-cedet-hook ()
(add-to-list 'ac-sources 'ac-source-gtags)
(add-to-list 'ac-sources 'ac-source-semantic)
(add-to-list 'ac-sources 'ac-source-semantic-raw))
(add-hook 'c-mode-common-hook 'my-c-mode-cedet-hook)
(global-ede-mode t)
After i test with this simple c++ file:
#include <string>
#include <map>
#include <stdio.h>
#include <iostream>
using namespace std;
int main() {
string s;
map<int,int>a;
}
I found it can complete keyword like include or header file.While when i try to complete the method of s,it fails.And when i use the command semantic-ia-complete-symbol
It just reports Cannot find types for string s
Can anybody tells me why it cannot work? And thanks very much!
Just update to latest Emacs. There, your example works with zero config, i.e.
M-x
semantic-mode
,semantic-ia-complete-symbol
.