Golevka / emacs-clang-complete-async

An emacs plugin to complete C and C++ code using libclang
360 stars 71 forks source link

unable to auto-complete for std thread library. #47

Closed maindoor closed 11 years ago

maindoor commented 11 years ago

This is the config I have and it works fine for a lot of libraries, but the library as installed on ubuntu 13.04 doesn't work at all. Should one declare the defines used in thread library like

if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)

somewhere in a cflags file ?

(require 'auto-complete-config) (add-to-list 'ac-dictionary-directories "~/.emacs.d/elpa/auto-complete-20130503.2013/dict") (setq ac-auto-start 1) (setq ac-auto-show-menu t) (ac-config-default)

(require 'auto-complete-clang-async)

(defun ac-cc-mode-setup () (setq ac-clang-complete-executable "~/Downloads/emacs-clang-complete-async-master/clang-complete")

(setq ac-clang-cflags (mapcar (lambda (item)(concat "-I" item)) (split-string " /usr/include/c++/4.7 /usr/include/c++/4.7/x86_64-linux-gnu /usr/include/c++/4.7/backward /usr/lib/gcc/x86_64-linux-gnu/4.7/include /usr/local/include /usr/lib/gcc/x86_64-linux-gnu/4.7/include-fixed /usr/include/x86_64-linux-gnu /usr/include " ))) (setq ac-sources '(ac-source-clang-async)) (ac-clang-launch-completion-process) )

(defun my-ac-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))

(my-ac-config)

toojays commented 11 years ago

By default, Clang uses the C++98 standard. <thread> requires C++11.

You should be able get this to work by adding -std=c++11 to your ac-clang-cflags. Try using M-x ac-clang-set-cflags to set it to just -std=c++11. You probably don't need to explicitly list those system include paths which are shown in your config; your Clang installation should already know about them.

maindoor commented 11 years ago

works like a charm. Thanks. closing the issue.