On macOS Mojave 10.14.6 (18G7016), gcc
can't find the file _ctermid.h
anymore
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>
This was either caused by a macOS software update or brew upgrade
.
This is might be related to an older question Can't compile C program on a Mac after upgrade to Mojave.
I tried the suggested solutions:
- deleting the whole
CommandLineTools
folder with(sudo) rm -rf /Library/Developer/CommandLineTools
and reinstalled itxcode-select --install
- installed the
macOS_SDK_headers_for_macOS_10.14
withopen /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
- reinstalled
brew
andgcc
(alsogcc@9
andgcc@8
)
None of them worked.