2

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.

Dan
  • 32,584
  • 6
  • 98
  • 168
  • You might want to checkout this [article](https://tuhdo.github.io/c-ide.html) 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](http://emacs.stackexchange.com/questions/474/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"](https://www.google.com/?client=ubuntu#channel=fs&q=emacs+tutorial) or ["emacs tutorial c++"](https://www.google.com/?client=ubuntu#channel=fs&q=emacs+tutorial+c%2B%2B) 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](http://emacs.stackexchange.com/help/how-to-ask) so you can see what kind of questions tend to work well here. – Dan Aug 28 '16 at 17:35
  • Little advise is to put all settings in org file and keep it on github server. Just clone repo and evaluate config.org. And you are done setting up, in case you need to go to some other computer. Here is my set up. [config.org](https://github.com/Opimenov/emacs_config/blob/master/config.org) It does not have indexer yet. I write smallish projects so don't really need it. – A_P Jan 13 '19 at 02:09

1 Answers1

1

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:

Steps:

  • 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).

chen bin
  • 4,781
  • 18
  • 36