0

I am having a problem building a program that uses

#include <filesystem>

My situation is the following:

  • I have Ubuntu 20.04

  • In my system:

    g++ --version
    g++ (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0

With this I can build a simple program with filesystem with

gcc -o test test.cpp -std=c++1z -lstdc++ -lstdc++fs

However, I have also a docker container.

Inside this docker container I have

 g++ --version
g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0

When I try to build here the program I got

fatal error: filesystem: No such file or directory
 #include <filesystem>

Does g++ 7.5.0 support filesystem?

KansaiRobot
  • 7,564
  • 11
  • 71
  • 150
  • 2
    Does this answer your question? [Why does GCC not seem to have the filesystem standard library?](https://stackoverflow.com/questions/45867379/why-does-gcc-not-seem-to-have-the-filesystem-standard-library) – Irad Ohayon Apr 27 '21 at 01:30
  • Seems like you answered your own question – M.M Apr 27 '21 at 01:30
  • I feel like gcc (and every major compiler) has a status page where you can easily see where support lies for versions of C++. cppreference has one that includes all major compilers as well. I feel like a few minutes googling would have been far more enlightening and fulfilling than waiting to be drip-fed. For your newer gcc, it'd also be `-std=c++17`. `1z` might not translate literally to `17` and might be missing even more features. At least that's how it is when clang transitions. – sweenish Apr 27 '21 at 01:39
  • so... g++ 7.5.0 does not support filesystem, does it? – KansaiRobot Apr 27 '21 at 01:40
  • 1
    g++ 7 is fairly old. The current version of g++ is 11, with 12 on the horizon. – Sam Varshavchik Apr 27 '21 at 01:57

0 Answers0