2

So irony-mode scans include directories through a file called .clang_complete, which looks like something like: -I./include/

However, it does not automatically load this file. Rather, I have to go into the source file and call irony-cdb and then load it manually by hitting l. I tried:

(add-hook 'c++-mode-hook 'irony-cdb-load-compile-options)

But it did not do anything. In fact, irony-mode wouldn't work period. I am trying to use irony-mode as a company-mode backend.

Q: How would I make this process automatic?

  • 1
    I edited my answer with the new usage. – Guillaume Papin Dec 6 '14 at 12:30
3

You have to use a more recent version of irony-mode to have automatic loading. This feature is supported since irony-mode's version 0.2.0-cvs. M-x irony-version to know you version.

To load the compile options manually the method has changed, you can call the interactive function irony-cdb-autosetup-compile-options manually: M-x irony-cdb-autosetup-compile-options RET.

To make this process automatic, you only need to add call this function automatically when irony-mode is enabled. This is easily done with a the add-hook function:

In your irony-mode configuration add:

(add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options)

See also https://github.com/Sarcasm/irony-mode#configuration

  • Ok I'll try this as soon as I can! – Asad-ullah Khan Dec 7 '14 at 1:09

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.