c++ - macOS fatal error : sys/_types/_int8_t. h : No such file or directory #include <sys/_types/_int8_t. h>

标签 c++ macos gcc clang homebrew

我最近更新了系统macOS Mojave 10.14,遇到了以下问题。我不会通过 gcc(我的版本 8.2)和 clang(7.0)使用++ 进行项目。问题是该程序,据我所知,没有找到标准库并给出了所有这样的错误:

/usr/local/bin/g++-8 -I//Users/MyNames/Desktop myFile.cpp -MyFinalFile -std=c++2a
In file included from /usr/local/Cellar/gcc/8.2.0/lib/gcc/8/gcc/x86_64-apple-darwin17.7.0/8.2.0/includ e/stdint.h:9,
from builddest.cpp:1:
/usr/local/Cellar/gcc/8.2.0/lib/gcc/8/gcc/x86_64-apple-darwin17.7.0/8.2.0/includ e-fixed/stdint.h:27:10:fatal error: sys/_types/_int8_t.h: No such file or directory

    #include <sys/_types/_int8_t.h>

根据包含的头文件,我会得到不同的错误。在互联网上我找到了一些提示,例如: 重新安装 XCode(我安装的版本 10.0 (10A255)),安装命令行工具——我重新安装了,但没有任何帮助。在 XCode 中一切正常。我的系统是 mac mini 2012, macOS 10.14 。在升级之前一切正常。我很乐意提供任何帮助 附: 如果您根本不添加任何依赖项,那么一切都会进行得很完美。

最佳答案

Mojave 更新后您需要重新安装 Homebrew 和 GCC。 GCC 工具链已经很多年没有包含在 MacOS 中了。从您的 cellar 目录中可以看出您使用的是 Homebrew 安装版本的 GCC。

请查看 Homebrew documentation并全新安装 Homebrew 和 GCC。请注意,您仍然需要 Xcode 命令行工具来安装和使用 Homebrew。

关于c++ - macOS fatal error : sys/_types/_int8_t. h : No such file or directory #include <sys/_types/_int8_t. h>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52599779/

相关文章:

c++ - 使用方法而不是构造函数设置值的类的一行初始化

c# - 如何将 C# 元组公开给 C++

c# - 有没有办法在调试中设置断点 "at this very moment"?它与任何编程语言或 IDE 有关

在 Mac 上编译 Unix 代码

gcc -o和-S可以一起用吗

c++ - 我可以获得指向当前迭代器值的指针吗

objective-c - 后台应用程序 : NSAlert before shutdown

macos - 在 mac bash 上格式化修改文件的日期/时间?

c - 为什么 printf 对于不同的编译器设置 64 和 32 显示错误的 int 变量值?

c++ - 如果我使用选项 -finit-local-zero 编译 Fortran,则 Fortran <-> C++ 互操作性的 Pb