help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

clang-complete-async didn't find additional include directories


From: tenexc
Subject: clang-complete-async didn't find additional include directories
Date: Tue, 4 Nov 2014 18:04:02 -0800 (PST)
User-agent: G2/1.0

As mentioned in the title, I try to get auto-complete to work for C++ 
Development.

The current status is, that clang complete symbols from files that are in the 
standard include paths from gcc (centos7 / gcc4.8.2).

Output from gcc -x++ -E -v - :

#include "..." - Suche beginnt hier:
#include <...> - Suche beginnt hier:
 /usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../../include/c++/4.8.2
 
/usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../../include/c++/4.8.2/x86_64-redhat-linux
 /usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../../include/c++/4.8.2/backward
 /usr/lib/gcc/x86_64-redhat-linux/4.8.2/include
 /usr/local/include
 /usr/include

Adding additional include directories defined in init.el did not work.

(require 'package)
(add-to-list 'package-archives
             '("melpa" . "http://melpa.milkbox.net/packages/";) t)
(package-initialize)
(setq url-http-attempt-keepalives nil)

(load-file "~/.emacs.d/build/cedet/common/cedet.el")

; enable rainbow-mode for css.like files
(require 'rainbow-mode)
(rainbow-mode t)

;(package-install "dakrone-theme")
(load-theme 'dakrone t)

(require 'yasnippet)
(yas-global-mode 1)

(defun my:ac-c-header-init()
  (require 'auto-complete-c-headers)
  (add-to-list 'ac-sources 'ac-source-c-headers)
  (add-to-list 'achead:include-directories "/usr/include/c++/4.8.2")
  (add-to-list 'achead:include-directories "/usr/include")
  (add-to-list 'achead:include-directories "/opt/Qt5.3.1/5.3/gcc_64/include")
  (add-to-list 'achead:include-directories 
"/opt/Qt5.3.1/5.3/gcc_64/include/QtWidgets")
)
(add-hook 'c++-mode-hook 'my:ac-c-header-init)
(add-hook 'c-mode-hook 'my:ac-c-header-init)

(require 'helm-config)

(helm-mode 1)

;; auto-complete
(require 'auto-complete)
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/.emacs.d/elpa/auto-complete/ac-dict")
(ac-config-default)
(global-auto-complete-mode t)
(setq-default ac-sources '(ac-source-words-in-same-mode-buffers))
(set-face-background 'ac-candidate-face "lightgray")
(set-face-underline 'ac-candidate-face "darkgray")
(set-face-background 'ac-selection-face "steelblue")
(define-key ac-completing-map "\M-n" 'ac-next)
(define-key ac-completing-map "\M-p" 'ac-previous)
(setq ac-auto-start 2)
(setq ac-auto-show-menu 0.8)
(setq ac-quick-help-delay 0.1)

;; auto-complete-clang-async

(require 'auto-complete-clang-async)

(defun ac-cc-mode-setup ()
  (setq ac-clang-complete-executable 
"~/.emacs.d/build/clang-complete/clang-complete")
  (setq ac-sources '(ac-source-clang-async))
  (ac-clang-launch-completion-process)
  )

(defun my-ac-config ()
  (setq ac-clang-flags
        (mapcar (lambda (item)(concat "-I" item))
                (split-string
                 "
      /usr/include \
    /usr/local/include \
    /usr/include/c++/4.8.2 \
    /usr/include/c++/4.8.2/bits \
    /usr/include/c++/4.8.2/tr1 \
    /usr/include/c++/4.8.2/tr2 \ 
    /usr/include/c++/4.8.2/backward \
    /usr/include/c++/4.8.2/x86_64-redhat-linux \
    /opt/Qt5.3.1/5.3/gcc_64/include/QtCore \
    /opt/Qt5.3.1/5.3/gcc_64/include/QtGui \
    /opt/Qt5.3.1/5.3/gcc_64/include/QtWidgets \
    /opt/Qt5.3.1/5.3/gcc_64/include/QtNetwork \
    /opt/Qt5.3.1/5.3/gcc_64/include/QtMultimedia \
    /opt/Qt5.3.1/5.3/gcc_64/include/QtQuickWidgets \
    /opt/Qt5.3.1/5.3/gcc_64/include/QtX11Extras
                   "
                   )))    

  (setq-default ac-sources '(ac-source-abbrev ac-source-dictionary 
ac-source-words-in-same-mode-buffers))
  (add-hook 'c-mode-common-hook 'ac-cc-mode-setup)
  (add-hook 'auto-complete-mode-hook 'ac-common-setup)
  (global-auto-complete-mode t))
(defun my-ac-cc-mode-setup ()
  (setq ac-sources (append '(ac-source-clang ac-source-yasnippet) ac-sources)))
(add-hook 'c-mode-common-hook 'my-ac-cc-mode-setup)
(my-ac-config)
(defmacro after (mode &rest body)
  `(eval-after-load ,mode
     '(progn ,@body)))
(after 'auto-complete
       (setq ac-use-menu-map t))

Because of a non working config with auto-complete-clang-async I tried to setup 
semantic with cedet.

I hope anyone have a solution for this problem. I can't find anything about 
this with google and I'm even no expert in emacs lisp.

Sorry for my english, it is not as good as I want it to be. ;)

I would greatly appreciate any help you can give me in working this problem.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]