7

There have been several questions about getting experimental/filesystem to compile in the latest versions of GCC and Clang: experimental::filesystem linker error

But now filesystem has been accepted into so no more need for experimental or the -lstdc++fs flag, right?

Wrong I cannot even #include <filesystem> on the head version of either clang++ or g++ when I try on: http://melpon.org/wandbox

Is there still some other argument I need? -lstdc++fs just gives me the experimental version, how can I include the officially accepted version?

Community
  • 1
  • 1
Jonathan Mee
  • 37,899
  • 23
  • 129
  • 288
  • 5
    There are lots of National Body comments raising issues relating to filesystem. I think that the compiler vendors are simply cautiously waiting for all these issues to be solved. – metalfox Feb 09 '17 at 07:04

1 Answers1

11

It is not specified in the C++ standards how exactly you must invoke your compiler. I guess this is up to implementations to decide, so there might still be a need for -lstdc++fs.

Note that C++17 is not yet officially a standard, and implementations may or may not yet have implemented it. Even when C++17 finally becomes a standard, this won't magically change the implementation. It doesn't even define what linker flags an implementation should or should not require. It is completely unrelated.

How you can include the officially accepted version after C++17 becomes a standard and your implementation begins to support it, is completely implementation-specific. We'll probably just have to wait and see how that works out.

jotik
  • 17,044
  • 13
  • 58
  • 123
  • 6
    I was going through maintaining my posts. I don't know if you'd care to extend speculations, I notice that even though C++17 now is standard, I'm still typing: -lstdc++fs – Jonathan Mee Oct 22 '18 at 11:52
  • 1
    2022 and still had to use `-lstdc++fs` because I didn't use GCC9 or higher. – SiGa Nov 29 '22 at 16:25