title: C++11: "put_time is not a member of std" on Modern g++
body: <p>I am having an old problem on a new compiler.  While trying to print the current time using <code>std::chrono</code> I receive the following error:</p>
  
  <pre><code>src/main.cpp:51:30: error: ‘put_time’ is not a member of ‘std’
                   std::cout &lt;&lt; std::put_time(std::localtime(&amp;time), "%c") &lt;&lt; "\n\n";
                                ^~~
  </code></pre>
  
  <p>The offending snippet is nothing special:</p>
  
  <pre><code>#include &lt;chrono&gt;
  ...
  auto time = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
  std::cout &lt;&lt; std::put_time(std::localtime(&amp;time), "%c") &lt;&lt; "\n\n";
  </code></pre>
  
  <p>This looks an awful lot like the errors being returned in the GCC 4.x series, as referenced all over the place:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/14136833/stdput-time-implementation-status-in-gcc">std::put_time implementation status in GCC?</a></li>
  <li><a href="https://stackoverflow.com/questions/44930645/why-does-stdput-time-not-compile-using-multiple-compilers">Why does std::put_time not compile using multiple compilers?</a></li>
  <li><a href="https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54354" rel="noreferrer">https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54354</a></li>
  </ul>
  
  <p>The only problem with this theory is that my GCC is modern:</p>
  
  <pre><code>$ g++ --version
  g++ (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1)
  Copyright (C) 2016 Free Software Foundation, Inc.
  This is free software; see the source for copying conditions.  There is NO
  warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  </code></pre>
  
  <p>I also checked that my application is linking against the appropriate libraries:</p>
  
  <pre><code>$ ldd build/myapp
          ...
          libstdc++.so.6 =&gt; /lib64/libstdc++.so.6 (0x00007fde97e7b000)
          libc.so.6 =&gt; /lib64/libc.so.6 (0x00007fde97595000)
  </code></pre>
  
  <p>Finally, there is nothing exotic going on in my compile flags:</p>
  
  <pre><code>g++ -g -Wall -Werror -std=c++11 -Wno-sign-compare src/main.cpp -c -o obj/main.o
  </code></pre>
  
  <p>Everything I can think to check indicates that this should be working.  So, in short, what gives?</p>