Compiler Support

Let's look at the compiler support for the topics in this chapter.

We'll cover the following

GCC/libstdc++

The library was added in the version 8.0, see commit - Implement C++17 Filesystem. Since GCC 5.3, you can play with the experimental version - the TS implementation.

Starting with GCC 9.1 the filesystem library is located in the same binary as the rest of The Standard Library, but before that release, you have to link with -lstdc++fs.

To compile demo.cpp you should write the following command:

// GCC 9.1 and up:
g++ -std=c++17 -O2 -Wall -Werror demo.cpp
// before GCC 9.1:
g++ -std=c++17 -O2 -Wall -Werror demo.cpp -lstdc++fs

Clang/libc++

The support for <filesystem> was implemented in version 7.0, you can see this commit. Since Clang 3.9, you can start playing with the experiential version, TS implementation.

Similarly to GCC (before GCC 9.1), you have to link to libc++fs.a.

Visual Studio

The full implementation of <filesystem> was added in Visual Studio 2017 15.7.

Before 15.7, you could play with <experimental/filesystem> in a much earlier version. The experimental implementation was available even in Visual Studio 2012, and later it was gradually improved with each release.

Feature GCC Clang MSVC
Filesystem 8.0 7.0 VS 2017 15.7

In the next chapter, we talk about parallel stl algorithms.

Get hands-on with 1200+ tech skills courses.