c++ - Emacs-24 auto-complete for cross-directory header files -
c++ - Emacs-24 auto-complete for cross-directory header files -
auto-complete
not work emacs c++ projects have multiple modules. header files each sub-module depends on exist both in module , in other modules. in other words, 1 module may include header files of module.
below sample source code:
. ├── cmakelists.txt ├── my_inc │ ├── cmakelists.txt │ ├── myadd.cpp │ └── myadd.h ├── readme.md └── src ├── cmakelists.txt ├── hello.java ├── helper.cpp ├── helper.h └── main.cpp
the main.cpp
:
#include "myadd.h" #include "helper.h" int main() { myadd add_obj; helper h; h.tostring(); // auto-complete works since helper in same directory. add_obj. // auto-complete add_obj not work // because myadd.h in directory (my_inc). }
the method list pops when type .
after h
, not variable add_obj
, class of defined in myadd.h
other module my_inc
.
i have tried solutions (cedet-related):
(ede-cpp-root-project)
this solution work here. not want apply 1 since
it create .emacs
big since have many projects.
:include-path
here unable handle complicated header dependence of 20+ sub-modules, makes solution more toy. prefer separating configuration .emacs
.
ede project
i create project , target via ede-new
, c c . t, compilation instead of name, method auto-complete.
ede-generic-project
as described in solution this question , manual on ede-generic-project
i'm getting error:
eieio-oref: wrong type argument: (or eieio-object-p class-p), nil
once execute:
m-x ede-customize-project
ret after (ede-enable-generic-projects)
.
environment: utilize emacs 24.3 , installed auto-complete
, cedet2.0
.
step 1 when working through issues involve projects, header files , completion enable (global-semantic-decoration-mode 1)
includes mechanism highlighting header files in reddish when can't found. helps in working through configuration problems.
if want maintain .emacs
file clean , project support, generic project type bet, right until error started showing up. fixed in cedet bzr repository under ede-ldf branch of writing (july 14, 2014) , merged sometime soon.
if have lots of sub-modules, can rely on tool gnu global. cedet manual has short section using gnu global includes snippet need help locate files. in way, global track headers, , can used find them. if headers have unique name, set. if file "myadd.h" exists in several places, , need take "myadd.h" based on c file is, out of luck, , need custom project type that.
after each configuration change, need forced reparse of buffer headers want found caches refreshed. utilize c-u m-x bovinate ret
forcefulness it.
c++ emacs autocomplete cedet
Comments
Post a Comment