CS 学生,在升级到 Mojave 之前编译工作正常。include
这样做之后,如果有声明,我将无法工作。例如:
#include <iostream>
int main()
{
std::cout << "length:" << 10 << std::endl;
return 0;
}
编译时:
$ 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.
我有
- 安装 Xcode 10
- 安装了最新的开发者命令行工具
- 我在 gcc 8.2 上(最新的 brew 提供)
遵循此处的建议,其中包括运行...
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
多次重启电脑
没有想法。直接从 Xcode 编译 c++ 就可以了。但是从命令行 g++ 反复失败。不知道下一步该去哪里。
如果相关,这适用于 MacBook Pro 15",2018。MacOS 10.14.0。
感谢任何人的时间。
编辑:
使用这里的信息,我可以使用
-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk
g++
在我的电话中标记。
当然,我不想永远这样做。
我已经完全删除了 Xcode 10 和 devtools,重新安装后问题仍然存在。
我还应该在这里做什么?只有我会受到怎样的影响?
最终编辑
最终重新安装操作系统以解决问题。对于谁知道有多大的钉子来说,这是一把大锤子,但它奏效了。