Why does GCC not seem to have the filesystem standard library?

GCC v7 still does not implement <filesystem> but it does have the Filesystem Technical Specification which is in <experimental/filesystem>

#include <experimental/filesystem>

// for brevity
namespace fs = std::experimental::filesystem;

int main()
{
    fs::path p = "/path/to/my/file"; // etc...
}

This is also available in GCC v6.

To link with the library you need to add -lstdc++fs to the command line.

Note: There may be some minor differences between the current Technical Specification and the final draft of <filesystem> that is decided upon by the Standards Committee.

Note 2: GCC v8 now implements <filesystem> with the -std=c++17 flag.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)