I'm new to Emacs. I followed a tutorial for Emacs as IDE for C/C++ but there are steps that do not work fully for me: the auto-complete for c-headers.
I installed yasnippet and auto-complete for C/C++ headers.
1) I get the normal auto-complete behavior for
#include <stdio.h but
> closing hook is not added even if I type tab on
2) And some functions (I don't know how many) aren't called even with their headers.
Other posts, particularly this one, helped me to solve an issue about
#include <float when is not completed with
.h, now it works but as alwas tab on
h does not add
So after changing my
.emacs from the link above ,
#include <ctype.h> doesn't call at least
isdig knowing that I want
getchar it doesn't add
()wherease for while, for loops it works fine...
Here is my new
.emacs after following the link above.
; start package.el with emacs (require 'package) ;add MELPA to repository list (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/")) ;initialize package.el (package-initialize) ;start auto-complete with emacs (require 'auto-complete) ;do default config for auto-complete (require 'auto-complete-config) (ac-config-default) ;start yasineppet with emacs (require 'yasnippet) (yas-global-mode 1) ;let's define a function which initializes auto-complete-c-headers and gets called for c/c++ headers hooks (defun my:ac-c-header-init () (require 'auto-complete-c-headers) (add-to-list 'ac-sources 'ac-source-c-headers) (setq achead:include-directories (append '("/usr/include/c++/5" "/usr/include/x86_64-linux-gnu/c++/5" "/usr/include/c++/5/backward" "/usr/lib/gcc/x86_64-linux-gnu/5/include" "/usr/local/include" "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed" "/usr/include/x86_64-linux-gnu") achead:include-directories))) ;now let's call this function from c/c++ hooks (add-hook 'c++-mode-hook 'my:ac-c-header-init) (add-hook 'c-mode-hook 'my:ac-c-header-init)
Something is missing ?
The path for headers comes from
gcc -xc++ -E -v -
ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/5" ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu" ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/5/../../../../x86_64-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /usr/include/c++/5 /usr/include/x86_64-linux-gnu/c++/5 /usr/include/c++/5/backward /usr/lib/gcc/x86_64-linux-gnu/5/include /usr/local/include /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed /usr/include/x86_64-linux-gnu /usr/include