I have a flake (or rather 26 different variations on the theme, trying to hack around the problem described below) which provides a C++ development environment. It uses meson, which produces a compile_commands.json
which enables clangd
to find standard headers. This works OK up to C++17.
For C++20 and 23, compilation of the code still works, but clangd
throws up spurious problems:
-
It cannot find standard headers which were not present before C++ 20 (e.g.
<bit>
), even though code that includes such headers compiles just fine. -
It complains about the flag
-std=c++23
, suggesting alternatives such asc++2b
, even though compiling with this flag (when the flake is configured to use clang_17) works just fine.
Do you have a configuration which doesn’t suffer these problems?
Could you suggest how to find a way around them?
It’s not clear to me how to navigate between the various packages such as clang
, llvmPpackages.clang
, clangStdenv
, llvmPackages.stdenv
, llvmPackages.clang.stdenv
, etc. (or their their various _17
variants).