title: "error: 'std::filesystem' has not been declared" in g++-8
body: <p>I'm trying to install a C++ compiler with support for the filesystem library. The GCC-8 compiler I installed from Homebrew is meant to have this, yet upon running </p>
  
  <pre><code>#include &lt;filesystem&gt;
  using std::filesystem::create_directories;
  
  int main()
  {
      create_directories("sandbox/a/b");
      return 0;
  }
  </code></pre>
  
  <p>using the command</p>
  
  <pre><code>g++-8 browse.cpp -o test
  </code></pre>
  
  <p>I get the following output:</p>
  
  <pre><code>browse.cpp:3:12: error: 'std::filesystem' has not been declared
   using std::filesystem::create_directories;
              ^~~~~~~~~~
  browse.cpp: In function 'int main()':
  browse.cpp:7:5: error: 'create_directories' was not declared in this scope
       create_directories("sandbox/a/b");
       ^~~~~~~~~~~~~~~~~~
  </code></pre>
  
  <p>This is completely inexplicable to me, as even my code editor (VS Code) manages to find the declarations of the filesystem namespace, the source of which is in the compiler's directory.</p>
  
  <p>edit: in response to the comments below, here's what happens when I try to do as recommended:</p>
  
  <pre><code>$ g++-8 browse.cpp -o test -std=c++17
  Undefined symbols for architecture x86_64:
    "std::filesystem::create_directories(std::filesystem::__cxx11::path const&amp;)", referenced from:
        _main in ccsGsUhu.o
    "std::filesystem::__cxx11::path::_M_split_cmpts()", referenced from:
        std::filesystem::__cxx11::path::path&lt;char [8], std::filesystem::__cxx11::path&gt;(char const (&amp;) [8], std::filesystem::__cxx11::path::format) in ccsGsUhu.o
  ld: symbol(s) not found for architecture x86_64
  collect2: error: ld returned 1 exit status
  </code></pre>
  
  <p>It looks like there's some problem with my installation, but I can't decipher what it might be.</p>