Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why Must I Still Use -lstdc++fs?

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 c++17 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?

like image 603
Jonathan Mee Avatar asked Feb 09 '17 06:02

Jonathan Mee


1 Answers

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.

like image 126
jotik Avatar answered Oct 16 '22 12:10

jotik