MaskRay / ccls

C/C++/ObjC language server supporting cross references, hierarchies, completion and semantic highlighting
Apache License 2.0
3.73k stars 254 forks source link

Emacs -ccls no member named 'variant' in namespace 'std' #901

Open ItsNilDev opened 2 years ago

ItsNilDev commented 2 years ago

Observed behavior

Every time I try to access some std libraries I get the following error: no member named 'x' in namespace 'std' for example:

#include <iostream>
#include <variant>

int main() {
  std::variant<std::string, int> s;
}

another example

#include <iostream>
#include <filesystem>

int main(int argc, char** argv) {
  std::filesystem::path filePath("./sample.cpp");
  std::cout << filePath.filename() << std::endl;
  return 0;
}

no member named 'filesystem' in namespace 'std'. I also get the following error: LSP :: Error from the Language Server: not indexed (Invalid Request) as mentioned in #874 I have tried many .ccls configurations, but none of them worked, example:

clang++
%c -std=c11
%cpp -std=c++17

also tried with clang, g++.

System information

ItsNilDev commented 2 years ago

Ok, I don't know why, but I noticed this issue happens when I install ccls. When I removed it everything works fine. But now I guess my client is using c++17 only, I can't change to C++20 with .ccls but It's possible with compile_commands.json