My current setup is as follows

Elementary OS Freya

  • Emacs version 24.5.1
  • company-mode 0.8.12
  • clang-3.5-dev
  • libclang-3.5-dev

I've checked that both libclang-3.5-dev and clang-3.5-dev are installed and I have also checked that clang was in /usr/bin. There is no problem on init but when I open a cpp file the following error in thrown

Company back-end 'company-clang' could not be initialized:                                     
Company found no clang executable

I'm trying to setup a C/C++ development environment in emacs, I was following this guide in order to achieve this.

i.e adding the following to my .emacs file

(require 'company)
(add-hook 'after-init-hook 'global-company-mode)
(setq company-backends (delete 'company-semantic company-backends))
(define-key c-mode-map  [(tab)] 'company-complete)
(define-key c++-mode-map  [(tab)] 'company-complete)

So how do I get clang recognized by company-clang?

  • Try using M-x customize-variable RET company-clang-executable RET and setting its value to the path to your executable.
    – elethan
    Commented Jan 6, 2016 at 15:05
  • thank you @elethan for your valuable insight! I was able to fix the problem by creating a symbolic link to the clang-3.5 named clang. Setting the correct path to the executable did not work which suggested that company-clang was looking for the wrong file. I was able to find the name of the file company-clang was looking for using M-x find-variable, and created a symbolic link to match to solve the problem.
    – greyowl
    Commented Jan 7, 2016 at 0:59

1 Answer 1


OP here, my clang executable wasn't being recognized by company-clang because the name of the executable in my /usr/bin was clang-3.5 and not clang.

  1. Using M-x customize-variable RET company-clang-executable RET as @elethan suggested and setting the absolute path to the clang executable didn't resolve the problem.
  2. Above suggested that company-clang was searching in the right place (directory) but not searching for the right file (clang executable)
  3. I used M-x find-variable RET company-clang-executable RET to find out the name of the file company-clang was looking.
  4. From company-clang.el, we can see that company-clang is looking for a file named clang
  5. In /usr/bin I created a symbolic link to my clang-3.5 named clang using the following command

    sudo ln -s /usr/bin/clang-3.5 clang


  1. My clang executable was not named clang
  2. Created a symbolic link named clang to my clang executable
  3. company-clang finds clang executable

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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