Skip to content
Advertisement

clangd on linux cannot find default headers

I’ve installed the newest LLVM toolchain from the official PPA, including clang, clang-tools-extra, lldb, lld, libc++ and libc++abi. I’m trying to use clangd with emacs + lsp.

All works fine except clangd cannot find default headers like memory, vector and so on. My code is fine, it is normally compiled using clang. My compile_commands.json also okay.

How to make clangd work?

Edit: removed mention about building llvm+clang from sources since it has been done incorrectly.

Advertisement

Answer

I didn’t find any info on the internet, so posting the solution here. Suppose the llvm toolchain is installed in /usr/lib/llvm-8. The answer is:

sudo ln -s /usr/lib/llvm-8/include/c++/v1 /usr/include/c++/v1

That’s it. Good luck.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement