I note that GCC is a compiler system that is separate and distinct from the Standard Library ( https://gcc.gnu.org/onlinedocs/gcc/Standard-Libraries.html ).
That said, GCC 8.0 includes the std::filesystem
library - but your project needs to be in C++17 mode to use it.
https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_headers.html#manual.intro.using.headers.cheaders
Table 3.9, “C++ 2020 Library Headers”
any
charconv
execution
filesystem
memory_resource
optional
string_view
variant
shows the C++17 include files. These are available in C++17 compilation mode, i.e. -std=c++17
or -std=gnu++17
. Including these headers in earlier modes will not result in compilation errors, but will not define anything. Unless specified otherwise below, they are also available in later modes (C++20 etc).
w.r.t. your specific question:
Thanks for the info. but what about std::experimental::filesystem
(which is what i'm using now), when was it introduced?
The release history for G++ says it was included in version 8.x (bold emphasis mine):
https://gcc.gnu.org/gcc-8/changes.html
Improved experimental support for C++17, including the following features:
- Deduction guides to support class template argument deduction.
std::filesystem
implementation.
std::char_traits<char>
and std::char_traits<wchar_t>
are usable in constant expressions.
std::to_chars
and std::from_chars
(for integers only, not for floating point types).