1

I am following this tutorial

When having enabled company-node upon typing for instance std::vec I get error message in the mini buffer saying:

clang failed with error 1:
/usr/bin/clang -fsyntax-only -Xclang -code-completion-macros -x c++ -Xclang -code-completion-at=-:8:14 -

However when I type just vec and then hit tab, I get a correct completion to std::vector<Class> var(10, Class());

Any idea what might be going wrong with clang here?

lo tolmencre
  • 169
  • 6

1 Answers1

1

I had this error recently, too. I think you could solve it with some clang-flags in the company-clang-arguments user option. You have to specify your Include-Paths and the Library-Paths and link the required libraries. Here it's the standard-library, so you have to edit company-clang-executable from clang to clang++! But i use Atila Neves' c-make-ide. I can recommend that. You have to write a CMakeLists.txt and specify here the include-paths and libs. Then call cmake-ide-setup and everything is configured. I call it via hook.

-tobi

user12841
  • 26
  • 2
  • Where do I find the company-clang-arguments user option? – lo tolmencre Aug 14 '16 at 18:15
  • First it might be rather company-clang-executable! Change that to clang++. And you find it by M-x apropos, then company-clang and click on edit. Or you can change it in your init-file. – user12841 Aug 14 '16 at 20:43
  • I tried it and it worked. Let me know if it works at you. – user12841 Aug 14 '16 at 21:03
  • I changed ` (executable-find "clang)` to ` (executable-find "clang++")` in company-clang.el and that made it work. Not sure if that is what you meant, but thanks anyway! – lo tolmencre Aug 17 '16 at 07:48