M. *_*uer 4 macos homebrew gcc
在 macOS 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>
Run Code Online (Sandbox Code Playgroud)
这可能是由 macOS 软件更新或brew upgrade.
这可能与一个较旧的问题Can'tcompileCprogramonaMacafterupgradetoMojave相关。
我尝试了建议的解决方案:
CommandLineTools文件夹(sudo) rm -rf /Library/Developer/CommandLineTools并重新安装xcode-select --installmacOS_SDK_headers_for_macOS_10.14了open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkgbrew和gcc(也gcc@9和gcc@8)他们都没有工作。
由于某种原因,xcode-select --install未安装适用于 macOS 10.14 (Mojave) 的最新命令行工具。
它始终安装 Xcode 10 的版本。
\n要解决此问题,请下载并安装Xcode 11.3.1 的命令行工具。\xe2\x80\x99 是仍然适用于 Mojave 的最新版本的 CLT。
\n如果上面的直接链接不起作用,请转到 \xe2\x80 \x9cApple 开发人员的更多下载\xe2\x80\x9d,使用 Apple 开发人员帐户登录,然后搜索 \xe2\x80\ x9cXcode 11.3.1\xe2\x80\x9d 的命令行工具。请注意,这不是CLT的最新版本,但可以在 Mojave 上安装更新的版本\xe2\x80\x99。
\n