Why Must I Still Use -lstdc++fs?

老子叫甜甜 提交于 2019-12-07 05:17:27

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/42129775/why-must-i-still-use-lstdcfs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!