Archlinux user using Emacs as a C++ IDE with the following setup : company / flycheck / lsp-ui / ccls
I'm trying to use filesystem
library from c++17 for personal use but I can't get rid of this error in Emacs
ccls : no member named 'filesystem' in namespace 'std'
A quick sample of my problem
#include <iostream>
#include <filesystem>
int main(int argc, char** argv) {
std::filesystem::path filePath("./sample.cpp");
std::cout << filePath.filename() < std::endl;
return 0;
}
Compilation and runtime are totally fine using this command :
clang++ -std=c++17 sample.cpp
Output : "sample.cpp"
But the "error" is still present inside Emacs which is kind of annoying. I tried to add .ccls
file with the following content but that doesn't solve the problem.
clang++
%cpp -std=c++17 ; Also tried with gnu++17
Here a screenshot of the problem. Error with cout
and filePath
are consequences of the first one I guess because everything is good in general
Does anybody know how to solve the problem ?
I encountered a similar issue to the one you're facing, using nvim + Ale + LanguageClient-neovim. I managed to compile my code successfully using clang++ with the -std=c++20 flag. However, I couldn't get rid of the error message in nvim indicating that it couldn't find the imported member. I even built my .ccls file, but it didn't resolve the problem.
Later, I realized that while I had configured LanguageClient, I had overlooked configuring my linter (Ale). So, it might be worth checking if your linter is also set up to use c++20. Hopefully, this suggestion proves helpful to you!