debian下需要安装apt安装下clang和llvm
sudo apt-get install llvm-dev
sudo apt-get install libclang-dev
网上抄来一个大神的配置
~/.emacs.d/el-get-user/recipes/clang-complete-async.rcp
(:name clang-complete-async
:website "https://github.com/Golevka/emacs-clang-complete-async"
:description "An emacs extension to complete C and C++ code using libclang."
:type github
:pkgname "Golevka/emacs-clang-complete-async"
:build '(("make"))
:depends auto-complete
:features auto-complete-clang-async
:prepare (setq ac-clang-complete-executable
(expand-file-name
(concat (el-get-package-directory "clang-complete-async") "clang-complete"))))
emacs,alt+x,执行el-get-install,输入clang-complete-async
在~/emacsConfig下建立clang-complete-async-setting.el
(require 'auto-complete-clang-async) (defun ac-cc-mode-setup ()
(setq ac-clang-complete-executable "~/.emacs.d/el-get/clang-complete-async/clang-complete") ;暂时没发现什么用处
;(setq ac-clang-cflags
; (mapcar (lambda (item)(concat "-I" item))
; (split-string
; "/usr/include/
; ~/Qt/SDK/include/
; /usr/include/c++/4.7/"))) (setq ac-sources (append '(ac-source-clang-async ac-source-yasnippet) ac-sources)) (ac-clang-launch-completion-process)) (defun ac-cc-mode-clang-config ()
(add-hook 'c-mode-common-hook 'ac-cc-mode-setup)
(add-hook 'auto-complete-mode-hook 'ac-common-setup)
(global-auto-complete-mode t)) (ac-cc-mode-clang-config)