So, I want to use the std::filesystem namespace in my project and discovered that clangd didn’t find it.
So, I checked whether I made a typo. Nope. However, clangd did find the needed header. After that I checked the header in question. Everything seemed in order. the namespace std was there, and so was filesystem.
After checking the sources, I went looking at the configuration of clangd and thought I needed to inform clangd about the standard being used, so I went to my .clangd and added it, to no avail. Clangd keeps complaining and here’s my .clangd file:
CompileFlags:
Add: -I/usr/include/fltk/
Add: -std=C++17
I’m actually stumped. How can I get clangd to recognize the std::filesystem namespace?
A good thing to check in a case like this is clangd’s logs (accessible .e.g in vscode via the “clangd” option in the Output window). The log shows what compile command clangd is actually using to process the file, so you can see if the expected flags are there.