# Clang, clang++, and clangd can't find headers, even with compile\_commands.json

**URL:** https://discourse.nixos.org/t/clang-clang-and-clangd-cant-find-headers-even-with-compile-commands-json/54657
**Category:** Help
**Created:** [October 20, 2024, 9:26pm UTC](https://discourse.nixos.org/t/clang-clang-and-clangd-cant-find-headers-even-with-compile-commands-json/54657 "2024-10-20T21:26:03Z")
**Posts on this page:** 1
**Showing post:** 6

<div class="post-metadata">

### Author: ![waffle8946](https://discourse.nixos.org/user_avatar/discourse.nixos.org/waffle8946/32/27221_2.png) [@waffle8946](https://discourse.nixos.org/u/waffle8946)
#### Post date: [November 29, 2024, 7:37pm UTC](https://discourse.nixos.org/t/clang-clang-and-clangd-cant-find-headers-even-with-compile-commands-json/54657/6 "2024-11-29T19:37:24Z")

</div>

What you’re meant to do is override the stdenv if you want it to use clang:

```nix
  pkgs.mkShell.override { stdenv = pkgs.clang19Stdenv; } {
    packages = [
      pkgs.cmake
      # ... whatever else, but NOT C compilers though!
    ];
  }

```

(or `inherit (pkgs.llvmPackages_19) stdenv;`, if you prefer)

and instead of the deprecated `devShell.<system>`, use `devShells.<system>.default`.

---

_[View the full topic](https://discourse.nixos.org/t/clang-clang-and-clangd-cant-find-headers-even-with-compile-commands-json/54657)._
