xcode - Xcode 默认 gcc (mis) 配置为为 iOS 而不是 macOS 编译
问题描述
看来 Xcode 10.2.1 破坏了我的gcc
安装。例如,如果我尝试编译一个简单的文件:
int main() {
printf("Hello, world!\n");
return 0;
}
运行它我得到:
dyld: mach-o, but built for simulator (not macOS)
Abort trap: 6
gcc -v
正在报告:
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/usr/include/c++/4.2.1
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
跳出来的选项是:
--with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/ iPhoneSimulator.platform /Developer/SDKs/iPhoneSimulator12.2.sdk/usr/include/c++/4.2.1
我最近安装了 iOS 模拟器,我假设这样做会导致这种情况。这是预期的行为吗?如果没有,有什么办法可以让我gcc
再次为 macOS 而不是 iOS 编译。
我曾尝试删除并重新安装 Xcode 命令行工具,但无济于事。我想解决方案是完全卸载并重新安装 Xcode,我有点犹豫。
解决方案
推荐阅读
- spring - 带有条件列表的 jpa findby
- python - 不知道是什么导致了这个错误“AttributeError:'_io.TextIOWrapper'对象没有属性'tk'”
- c - 如何修复“分段错误(核心转储)”?
- python - openpyxl table change table existing (automatic) filter
- kubernetes - 为什么 Kubernetes 网络模型不要求在防火墙上打开服务集群 ip 范围?
- sql - 将 WHERE 子句添加到外部查询会导致内部查询出错
- google-colaboratory - 当我在 Google Colaboratory 上训练模型时,我的笔记本电脑开始发热
- python - 我已经安装了 Tensorflow,但无法在 Python 中导入它:ImportError: cannot import name 'descriptor' from 'google.protobuf' (unknown location)
- ios - 什么时候可以安全地对 tableHeaderView 设置约束?
- javascript - 当 iframe 的内容未加载时隐藏 amp-iframe