Search code examples
c++ideclangd

Tell clangd to look in usr/local/include


I use clangd in vscode with cmake normally and it works great, but I'm now working on a proect where the build is done with poetry and clangd doesn't know about any of the dependencies. I'm getting all sorts of editor cruft relating to undefined headers.

A simple fix would be to make clangd look into /usr/local/include to resolve a lot of issues. Is there a simple config file I can add to the root of my project to resolve this?


Solution

  • I managed to solve this quite quickly, but for anyone looking in the future I solved this by placing a compile_flags.txt in the directory with the cpp source code as documented at the end of the clangd docs for use in simple situations.

    It contains ..

    -xc++
    -I
    /usr/local/include