Hi everyone I am new to Emacs and was taking help of tutorials to make emacs an IDE for languages like c/c++.

I started out with the youtube tutorials by b yuksel at https://www.youtube.com/channel/UCibKclzsnnHjQZFOLuykZ1A

But these tutorials are 2 years older now and many packages have changed their structure therefore it is not clear how to move forward. However I am taking help from stackoverflow but still it seems insatiable.

And many packages ask for some other package to be installed first and that package have some other prerequisite.

Currently I am stuck with irony-mode for C++.

  1. I have installed packages (in this sequence) auto-complete, yasnippet, auto-complete-c-headers, iedit, flymake-google-cpplint, google-c-style and semantic and cedet.

  2. Now I wanted to install the irony-mode package with clang, so i started with downloading irony-mode zip from github and along with it mjpa-SimlpeJSON.

  3. Now I have to move simpleJSON to lib folder in irony-mode directory. But there is no lib folder in irony-mode directory?

  4. Then somehow I managed to install irony-mode but next step was to install doxygen and when i tried it it asked for some prerequisite packages like flex, bison, libiconv and strip.

  5. And to install bison i need some other packages installed.

Therefore I am confused what to install and in which sequence.

My motive is to improve my editing experience in emacs for c/c++. And I being a dilettante in emacs just followed the simple instructions posted by people on internet.

But now I am stuck and need help.

So can anyone please post an easy way to install irony-mode with clang. And if you can explain why each package is necessary and what does it do(significance of each package), then I will be very grateful.

I am using ubuntu 16.04.

  • You might want to checkout this article from tuhdo. Very comprehensive, I haven't tried setting it up myself. But it doesn't quite answer your question about irony-mode. – Chakravarthy Raghunandan Aug 24 '16 at 12:14
  • @ChakravarthyRaghunandan thanks for sharing and yes its way comprehensive for a beginner :) – Rajat Gupta Aug 24 '16 at 12:46
  • Welcome to Emacs.SE! Unfortunately, this is not the right venue for tutorials. Please edit your question to make it more discrete and less open-ended. You can make multiple posts with different questions. But first, please look at Using Emacs as a full-featured C/C++ IDE. – Dan Aug 24 '16 at 13:24
  • @Dan hi firstly I am sorry that I was not able to ask this question correctly and I made it open-ended. Since I am a beginner can you please help me with Emacs. It would be much appreciated if you can share any tutorials and other materials through which I can make learning Emacs and lisp more easier. Thanks – Rajat Gupta Aug 28 '16 at 15:40
  • A good place to start is with Emacs's built-in tutorial: type C-h t to get started. After that, try some web searches for "emacs tutorial" or "emacs tutorial c++" and you'll find some useful resources with which to start. Have a browse on this site for norms about how to ask a good question so you can see what kind of questions tend to work well here. – Dan Aug 28 '16 at 17:35

Here is the easy solution for newbies.

It works at Linux/OSX/Cygwin (should work at Windows, but I don't develop at Windows).

The setup is minimum. You need install GNU Global and two Emacs plugins:


  • suppose you have two C++ projects, ~/proj1, ~/proj2, and has a read-only 3rd party library diretory /usr/include

  • create a directory to store index files of third party library ~/obj

  • run command cd /usr/include && MAKEOBJDIRPREFIX=~/obj gtags -O && cd ~/proj1 && gtags && cd ~/proj2 && gtags in shell to create code index file used by GNU Global

  • insert below code into your ~/.emacs

    (setenv "GTAGSLIBPATH" (concat "/usr/include" ":" (file-truename "~/proj2") ":" (file-truename "~/proj1")))

    (setenv "MAKEOBJDIRPREFIX" (file-truename "~/obj/"))

    (setq company-backends '((company-dabbrev-code company-gtags)))

  • Done.

Extra tips:

  • Minimum setup copied from company and emacs-helm-gtags github page is enough

  • Please note in ~/.emacs, I use file-truename to make sure all paths are real absolute path

  • I just fixed a global issue of company yesterday (24 August, 2016). So you need use the company built today (25 August, 2016).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.