lsp linting clangd throws a linting error when doing an include e.g #include <iostream> error bits/c config.h file not found
I already installed mingw(via choco install) and added it to my path
also tried added the includes
enter image description here
same with LLVM!
but when I tried to build a hello world program using cmake it works as expected.
I also copied the compile_command.json to my root generated by cmake
I been spending 2 days to solve this, but still no luck
here's the linting problem. (lsp clangd windows)
any help is greatly appreciated.
CodePudding user response:
Finally. ah. sigh.. I fixed it. I'm doing things wrong from the start. there's no need to add flags to include everything e.g -I that has been missing. There's nothing wrong on the clangd itself. The problem lies on your lsp config.
I'm using windows,powershell, no wsl, nvim -> lunarvim and cmake the fix is simple you just need to add the compile command path on your --query-driver on your clang lsp config
after that everything should work nice and smooth
CodePudding user response:
the include errors occur because of wrong lsp clangd config
here is my solution for solving the issue
here's the image of the path that you should had into your --query-driver
compile_command.json generated by cmake
Your --query-driver should be the same as your command path listed on your compile_command.json
after that errors about missing includes should gone by now