reddit / emacs

Add a -I include path for clangd in eglot

Agreeable-Solid7212 · 2022-06-30 16:16
I'm using the clangd language server in eglot, and I want clangd to be able to locate files in an include directory. I've tried adding a .clangd into the root of my project directory as [this](https://stackoverflow.com/questions/61206703/is-there-includepath-option-in-clangd) post says, but it has not worked for me.
Horrih · 2022-06-30 16:46
Generate a compile_commands.json, either from a Makefile (with the bear utility) or cmake, and put it at the root of your project and clangd will automatically read all the options
J-ky · 2022-07-01 03:14
Just create a compile_flags.txt and place it at the project root by hand. At each line, specify your flags. -I/usr/local/include I don’t even bother to use bear to generate a json.