Hi,
I am using spacemacs (emacs distribution) and I activated the C/C++ layer with clangd as the backend for LSP.
I am currently doing a project with the gtkmm library and in one of my headers I include the library like this :
#include <gtkmm.h>
The library is installed on my system but clangd doesn’t recognize it and says :
'gtkmm.h' file not found [pp_file_not_found]
It really annoys me because now I have errors everywhere like so :

So is it possible to tell clangd where the external libraries are with lsp and emacs?
System :
- OS :
Pop!_OS 20.04
- spacemacs :
develop branch ca2cdd0fc
- clangd :
clangd version 10.0.0-4ubuntu1
(Btw : I created a topic on the emacs stack exchange but no answers yet… )
you need to tell clangd how to compile your project. you can find details in https://clangd.llvm.org/installation.html#project-setup
1 Like
Hi,
Thanks for pointing this out!
It works now, I should have check the documentation…
One thing is that I am using the meson build system so all the build files are located under a special build
folder and this is where the compile_commands.json
file is.
So is there a way to tell clangd to check the json file located in a specific folder?
after clangd-11, we’ll also be looking for directories named build
to find compile_commands.json. but for a general solution, you can either:
- create symlink in your project root, pointing at the compile_commands.json inside the build directory
- provide
--compile-commands-dir=<string>
to clangd, pointing at the directory containing the compilation database.
1 Like
Thanks for your complete answer, have a great day! 