Demo Video: http://www.youtube.com/watch?v=vhs5r-iGpNU
includeme is an extension for GNU Emacs that will automatically insert
#include
C/C++ and it's 100% guaranteed to actually work. For instance if you started
writing a new C++ program and typed cout and then pressed the magic key,
includeme would then insert #include <iostream> and using std::cout at
the top of your file.
So what's the catch? It only works for popular and standardized APIs. No attempt is made whatsoever to analyse your code. includeme comes with a database of all the symbol and header definitions for libraries deemed important by Justine Tunney. Things like POSIX, the Standard C Library, C++ STL, etc.
Run make and put this stuff in your init file:
(add-to-list 'load-path "/PATH/TO/INCLUDEME")
(require 'includeme)
(define-key c-mode-base-map (kbd "C-c i") 'includeme)
Insert headers and using statements necessary to for name under cursor to compile.
For example if you type "std::cout" and run this command in a
C++ buffer, includeme will insert #include <iostream> at the
top of your buffer. If you had only typed "cout" then includeme
would have also inserted a using std::cout statement.