【发布时间】:2019-03-07 01:48:01
【问题描述】:
我最近更新了系统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 。在升级之前一切正常。我很乐意提供任何帮助 p.s. 如果你根本不添加任何依赖项,那么一切都很顺利。
【问题讨论】:
-
这不是标准的 c++ 头文件,而是编译实现的一部分。您不应该将这些直接包含在您的代码中。
-
是的,我没有打开它 - 我的代码中有这样的标题 - #include
#include #include #include #include #include #include 问题是它不能包含毫无问题的简单标头,也就是说,如果您更改它们并替换一些 #include 那么它仍然无法编译 - 只会出现另一个错误:致命错误:找不到'string.h'文件#include_next ^ ~~~~~~~~~ -
我不希望这有多大帮助,但请尝试
#include <cstdint>。 -
/usr/local/bin/g++-8 -I//Users/MyNames/Desktop myFile.cpp -MyFinalFile -std=c++2a是编译器命令行吗?这没有多大意义。看起来您正试图将 ann 包含文件夹指向 cpp 文件,而我不知道-MyFinalFile应该做什么。
标签: c++ macos gcc clang homebrew