title: Can't compile C++ 'hello world' with `#include` after upgrading to Mojave
body: <p>CS student, compiling worked fine before upgrading to Mojave. After doing so I cannot get anything to work if it has an <code>include</code> statment.  For example:</p>
  
  <pre><code>#include &lt;iostream&gt;
  int main()
  {
      std::cout &lt;&lt; "length:" &lt;&lt; 10 &lt;&lt; std::endl;
  
      return 0;
  }
  </code></pre>
  
  <p>On compiling:</p>
  
  <pre><code>$ g++ -ferror-limit=3 main2.cpp -o test
  In file included from main2.cpp:1:
  In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/iostream:38:
  In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/ios:216:
  In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__locale:15:
  In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string:477:
  In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string_view:176:
  In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__string:56:
  In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/algorithm:642:
  In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/utility:203:
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstdint:158:8: error: no member named 'uint8_t' in the global
        namespace
  using::uint8_t;
       ~~^
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstdint:159:8: error: no member named 'uint16_t' in the global
        namespace
  using::uint16_t;
       ~~^
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstdint:160:8: error: no member named 'uint32_t' in the global
        namespace
  using::uint32_t;
       ~~^
  fatal error: too many errors emitted, stopping now [-ferror-limit=]
  4 errors generated.
  </code></pre>
  
  <p>I have</p>
  
  <ul>
  <li>Installed Xcode 10</li>
  <li>Installed the latest developer command line tools </li>
  <li>I am on gcc 8.2 (the latest brew provides)</li>
  <li><p>followed the suggestions <a href="https://stackoverflow.com/questions/52509602/cant-compile-c-program-on-a-mac-after-upgrade-to-mojave">here</a>, which included running...</p>
  
  <pre><code>open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
  </code></pre></li>
  <li><p>Restarted computer many times</p></li>
  </ul>
  
  <p>Out of ideas. Compiling c++ from Xcode directly worked. But from command line g++ fails repeatedly. Not sure where to go next.</p>
  
  <p>If relevant this is on MacBook Pro 15", 2018. MacOS 10.14.0.</p>
  
  <p>Thanks for anyone's time.</p>
  
  <p><strong>Edit:</strong> </p>
  
  <p>Using the information <a href="https://stackoverflow.com/questions/49590038/error-no-member-named-uint8-t-in-the-global-namespace-on-macos">here</a> I can compile some things using the</p>
  
  <pre><code>-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk
  </code></pre>
  
  <p>flag in my <code>g++</code> calls. </p>
  
  <p>Of course I don't want to need to do this forever.</p>
  
  <p>I have COMPLETELY removed Xcode 10 and devtools, and after reinstalling them the issue persists.</p>
  
  <p>What else should I do here? How would it affect only me?</p>
  
  <h1>FINAL EDIT</h1>
  
  <p>Ended up reinstalling OS to solve issue. Was a big hammer for who knows how big of a nail, but it worked.</p>