reddit / emacs

Using clang lsp in a non clang project

Schievel1 · 2022-07-08 17:02
[removed]
Schievel1 · 2022-07-09 07:59
I figured this out. You give clangd include directory’s with different config files. The following commands can be put in config.yaml in c:\Users\USERNAME\AppData\clangd\config.yaml or in a .clangd file inside the project. Global system includes are done with -isystem. You can put them in config.yaml or .clangd, but I think it makes sense (at least for me) to put them into config.yaml. Project imports go in clangd, the command is -I. Problem is the way you have to put windows paths into the files. This is the way: [“-Ic:\\path\\to\\your\\include\\directory”, “-Ic:\\path\\to\\another\\include\\directory”] Rest of the syntax is here: https://clangd.llvm.org/config.html#compileflags After starting lsp with clangd in emacs you can watch the buffer *clangd-stderr* and see that is included and error if the syntax in the config or .clangd was wrong