在macOS Mojave 10.14.6上找不到_ctermid.h

豪雅

MacOS的莫哈韦10.14.6(18G7016),gcc找不到该文件_ctermid.h

In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/wchar.h:90,
                 from /usr/local/Cellar/gcc/10.2.0_2/include/c++/10.2.0/cwchar:44,
                 from /usr/local/Cellar/gcc/10.2.0_2/include/c++/10.2.0/bits/postypes.h:40,
                 from /usr/local/Cellar/gcc/10.2.0_2/include/c++/10.2.0/bits/char_traits.h:40,
                 from /usr/local/Cellar/gcc/10.2.0_2/include/c++/10.2.0/string:40,
                 from /Users/Projects/test.h:10,
                 from /Users/Projects/test.cpp:1:
/usr/local/Cellar/gcc/10.2.0_2/lib/gcc/10/gcc/x86_64-apple-darwin18/10.2.0/include-fixed/stdio.h:219:10: fatal error: _ctermid.h: No such file or directory
  219 | #include <_ctermid.h>

这可能是由于macOS软件更新引起的brew upgrade

这可能与一个较旧的问题有关:升级到Mojave后,无法在Mac上编译C程序

我尝试了建议的解决方案:

  • 删除整个CommandLineTools文件夹(sudo) rm -rf /Library/Developer/CommandLineTools并重新安装xcode-select --install
  • 安装在macOS_SDK_headers_for_macOS_10.14open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
  • 重新安装brewgcc(也gcc@9gcc@8

他们都没有工作。

康拉德·鲁道夫

由于某些原因,请xcode-select --install不要为macOS 10.14(Mojave)安装最新的命令行工具。

它总是安装Xcode 10的版本。

要解决此问题,请下载并安装Xcode 11.3.1的命令行工具那是仍适用于Mojave的CLT的最新版本。

如果上面的直接链接不起作用,请转到“ Apple开发者的更多下载”,使用Apple Developer帐户登录,然后搜索“ Xcode 11.3.1命令行工具”。请注意,这不是CLT的最新版本,但是不能在Mojave上安装最新版本。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章