I want to add/expand the Clangd Language server, which I installed through Mason within Neovim, with the standard libraries that come with MinGW (I run windows 11). I'm trying to do CP, and for that I need <bits/stdc++.h> header file. The problem is, Clangd doesn't not recognize that header file and doesn't give me any intelli-sense & gives me warnings saying 'E447: Can't find file "std" in path', and things similar to it. I build the .cpp files using the command (keybinded) :!g++ Wall prac.cpp -o a.exe and it has no problem with the header file (I think because the compiler of MinGW is used here). Std is not recognized Header file is not recognized

I went through several threads regarding this. I tried the following:

  1. Tried to add an compile_commands.json file, but ended up not knowing where to add/save the file. (The bin of Mason in nvim-data 'C:\Users\Ankit\AppData\Local\nvim-data\mason\packages\clangd\clangd\bin' (\clangd\clangd is not typo) has only clangd.exe file in it) -- **couldn't figure how to tell clangd to find the header files from the MinGW folder.

  2. I was thinking of adding the header files themselves to the place Clang searches for header files but realised that Clang comes from LLVM (didn't do it).

Please see the followings attachments for verbose.

This is for Clang but it comes from LLVM

This is for clangd from Mason

This for my g++

I also have LLVM installed in my system. Hence, I want to add the header file in the LSP server if possible to remove the errors. (NOTE: The server works absolutely fine with headers like iostream, vector etc. I just want to add that header for CP only).

EDIT:: I want to know how I can add the compile_commands.json file for Clangd, which is installed through Mason in NVIM. I realise that this is more of a Mason and Clangd issue than it is an NVIM issue, but since Mason is a 'plugin' of Neovim, I believe that I can get some answers here.


1 Answer 1


The trick here is to use bear. Do the following:

Go to the root of your C++ project. Now use your building tool (like make), which you'd use to build your project and pick up the command which you'd normamlly invoke to build your project.


Let's say that you have a Makefile in the root of your project and you'd simply just execute make to build your project. All you need to do is to execute bear -- make instead of make. This should generate a compile_comands.json for you in your project-root directory. Now just open up neovim and clangd will automatically read it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.