CS student, compiling worked fine before upgrading to Mojave. After doing so I cannot get anything to work if it has an include
statment. For example:
#include <iostream>
int main()
{
std::cout << "length:" << 10 << std::endl;
return 0;
}
On compiling:
$ 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.
I have
- Installed Xcode 10
- Installed the latest developer command line tools
- I am on gcc 8.2 (the latest brew provides)
followed the suggestions here, which included running...
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
Restarted computer many times
Out of ideas. Compiling c++ from Xcode directly worked. But from command line g++ fails repeatedly. Not sure where to go next.
If relevant this is on MacBook Pro 15", 2018. MacOS 10.14.0.
Thanks for anyone's time.
Edit:
Using the information here I can compile some things using the
-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk
flag in my g++
calls.
Of course I don't want to need to do this forever.
I have COMPLETELY removed Xcode 10 and devtools, and after reinstalling them the issue persists.
What else should I do here? How would it affect only me?
FINAL EDIT
Ended up reinstalling OS to solve issue. Was a big hammer for who knows how big of a nail, but it worked.