I'm working on an embedded system and need to limit clang to only the header files of the embedded system code while I'm editing its code. I need to make the following work:

  1. Make sure that company-mode with the clang backend only includes stuff inside the header files of the embedded system.

  2. Make sure that C-c C-e includes system headers of the embedded platform

In other words, if a file contains #include <stdio.h> it should look into the folder /home/<user>/src/include and not e.g. /usr/include. I assume this should be done by making sure that -nobuiltininc is always passed to clang together with the appropriate -I/home/<user>/src/include. My question is what should I put in the .dir-locals.el file under ~/src?

  • You need to set company-clang-arguments. Are you familiar with how to do that?
    – Dmitry
    May 11, 2015 at 10:53

1 Answer 1


I had the same problem, this seemed to do the trick

((c-mode . ((company-clang-arguments . (list  ("-I/your/absolute/paths/here/"))))))

on .dir-locals.el

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.