0

I'm trying to use the filesystem library and it's not working I need help about compiling this.

I tried to change the included file and I updated my compiler but nothing works

here are the inclusions I made

#include <experimental/filesystem>
namespace fs = std::filesystem;

I compile the cpp file with this command

g++ -Wall -c indexation_fichier.cpp

I get this error

indexation_fichier.cpp:5:10: fatal error: experimental/filesystem: No such file or directory
 #include <experimental/filesystem>
      ^~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

and here is my compiler version

g++ (MinGW.org GCC-8.2.0-1) 8.2.0

when I type

g++ --version

I want to know what is wrong and what I need to do to make this library work because I need it for my project. thanks.

  • 1
    Try leaving out the "experimental/". The filesystem library was included in standard C++ in the 2017 version. – Pete Becker Dec 31 '18 at 19:01
  • Possible duplicate of [Why can't I use with g++ 4.9.2?](https://stackoverflow.com/questions/30103209/why-cant-i-use-experimental-filesystem-with-g-4-9-2) – Mike Lui Dec 31 '18 at 19:53
  • Possible duplicate of [Link errors using members in C++17](https://stackoverflow.com/questions/48729328/link-errors-using-filesystem-members-in-c17) – Mike Lui Dec 31 '18 at 19:59
  • @PeteBecker I tried and it works thank you so much – Mister onsépatro Jan 01 '19 at 18:39

0 Answers0