问题描述
关于获取编译为最新版本的GCC和Clang:
There have been several questions about getting experimental/filesystem
to compile in the latest versions of GCC and Clang: experimental::filesystem linker error
但是现在已被接受为,因此不再需要实验性
或 -lstdc ++ fs
标志,对吗?
But now filesystem
has been accepted into c++17 so no more need for experimental
or the -lstdc++fs
flag, right?
错误我什至不能 #include< filesystem> $尝试使用
clang ++
或 g ++
的头版上的c $ c>:
Wrong I cannot even #include <filesystem>
on the head version of either clang++
or g++
when I try on: http://melpon.org/wandbox
还有其他一些论点吗?需要? -lstdc ++ fs
只是给我提供了实验性
版本,如何包含正式接受的版本?
Is there still some other argument I need? -lstdc++fs
just gives me the experimental
version, how can I include the officially accepted version?
推荐答案
在C ++标准中没有指定必须如何调用编译器。取决于实现方案,因此可能仍然需要 -lstdc ++ fs
。
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
.
请注意,C ++ 17尚未正式成为标准,实现可能已经实现,也可能尚未实现。即使C ++ 17最终成为标准,这也不会神奇地改变实现。它甚至都没有定义实现应该或不需要的链接标志。它是完全无关的。
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.
在C ++ 17成为标准并且您的实现开始支持它之后,如何包括正式接受的版本,完全取决于实现。我们可能只需要等待,看看效果如何。
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.
这篇关于为什么还必须使用-lstdc ++ fs?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!