【问题标题】:_ctermid.h not found on macOS Mojave 10.14.6在 macOS Mojave 10.14.6 上找不到 _ctermid.h
【发布时间】:2021-04-16 21:46:30
【问题描述】:

ma​​cOS Mojave 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 引起的。

这可能与较早的问题Can't compile C program on a Mac after upgrade to Mojave有关。

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

  • (sudo) rm -rf /Library/Developer/CommandLineTools 删除整个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

它们都不起作用。

【问题讨论】:

  • brew doctor 说:Warning: A newer Command Line Tools release is available. Update them from Software Update in System Preferences or run: softwareupdate --all --install --force If that doesn't show you an update run: sudo rm -rf /Library/Developer/CommandLineTools sudo xcode-select --install 后者是我已经做过的。

标签: macos gcc homebrew


【解决方案1】:

由于某种原因,xcode-select --install 没有安装最新的 macOS 10.14 (Mojave) 命令行工具。

它总是安装 Xcode 10 的版本。

要解决此问题,请下载并安装 Command Line Tools for Xcode 11.3.1。这是仍然适用于 Mojave 的最新版本的 CLT。

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

【讨论】:

  • 直接链接不起作用,所以我不得不按照您的描述登录。现在,使用 Xcode 11.3.1 的 CLT,它再次像魅力一样工作。非常感谢!
  • 愿 StackOverflow 之神对你微笑。我的问题解决了。
猜你喜欢
  • 1970-01-01
  • 2020-12-10
  • 1970-01-01
  • 2019-04-27
  • 2019-03-08
  • 2020-05-30
  • 2020-07-16
  • 2019-03-02
  • 1970-01-01
相关资源
最近更新 更多