2

I am using Atom to write C++ code and have installed the llvm suite to use an Atom package which uses the clangd language server. It seems to be working, except that clangd doesn't seem to find the standard headers (e.g. iostream, algorithm). I installed llvm using the prebuilt Windows binaries. The error that shows up in the Atom Diagnostics pane is " 'algorithm' file not found".

Does anyone have any ideas what I can do to get clangd to find the standard headers?

scmartin
  • 53
  • 1
  • 6
  • Welcome to SO. See "[MCVE](https://stackoverflow.com/help/minimal-reproducible-example)", "[Writing The Perfect Question](https://codeblog.jonskeet.uk/2010/08/29/writing-the-perfect-question/)" and "[How To Ask Questions The Smart Way](http://catb.org/esr/faqs/smart-questions.html)". You're asking us to imagine what you've done, and that's not fair because we're not that good at guessing. Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. – the Tin Man May 23 '20 at 07:42
  • @theTinMan, sorry that probably wasn't the best way to word the question, but this wasn't really a code debugging issue, so I wasn't sure how to include a MWE. Basically, I installed the Atom package, I installed the llvm toolset using their pre-built binaries, and when I open any C++ file in Atom, the Atom package mentioned above gives the error message I listed in the question. – scmartin May 25 '20 at 03:08

1 Answers1

1

I figured it out thanks to "How to use clang with mingw-w64 headers on windows".

Using the llvm prebuilt binaries, clangd looks for MSVC libraries, which I did not have; I use the MinGW compilers.

To have clangd look for the header files in the appropriate location, where the MinGW standard header files are located, I needed to include the compiler option:

--target x86_64-pc-windows-gnu

in the compiler_flags.txt or compile_commands.json file.

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
scmartin
  • 53
  • 1
  • 6