执行 a.out 文件时出现问题 (C++) MacOS Sierra 10.12.1

2023-12-01

我刚刚更新到 Sierra,似乎我的编译器由于某种原因崩溃了。

我编写的代码在更新之前工作正常,所以我确信这不是问题,但现在当我尝试执行它时它就无法工作。

这是输出。

$ g++ source.cpp
$ ./a.out
dyld: mach-o, but built for simulator (not macOS)
Abort trap: 6

为 @NulledPointer 运行 G++ 详细信息

$ g++ --verbose source.cpp
Apple LLVM version 8.0.0 (clang-800.0.38)
Target: x86_64-apple-darwin16.1.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-ios7.0.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -Werror=implicit-function-declaration -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name source.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 274.1 -v -dwarf-column-info -debugger-tuning=lldb -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.0.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.0.sdk -stdlib=libc++ -Wno-error -fdeprecated-macro -fdebug-compilation-dir /Users/USERNAME/FILE_DIRECTORY/ -ferror-limit 19 -fmessage-length 130 -stack-protector 1 -fblocks -fobjc-runtime=ios-7.0.0 -fencode-extended-block-signature -fcxx-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -o /var/folders/kr/tvqfrgdx2w32m0c9fq96zddc0000gn/T/source-355902.o -x c++ source.cpp
clang -cc1 version 8.0.0 (clang-800.0.38) default target x86_64-apple-darwin16.1.0
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.0.sdk/usr/include/c++/v1"
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.0.sdk/usr/local/include"
#include "..." search starts here:
#include <...> search starts here:
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.0.0/include
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.0.sdk/usr/include
 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.0.sdk/System/Library/Frameworks (framework directory)
 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.0.sdk/Library/Frameworks (framework directory)
End of search list.
 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch x86_64 -ios_simulator_version_min 7.0.0 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.0.sdk -o a.out /var/folders/kr/tvqfrgdx2w32m0c9fq96zddc0000gn/T/source-355902.o -lc++ -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.0.0/lib/darwin/libclang_rt.ios.a

运行该命令 NulledPointer 发布时出错。

clang: warning: no such sysroot directory: '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk'
clang: warning: using sysroot for 'MacOSX' but targeting 'iPhone'
In file included from source.cpp:10:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iostream:38:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/ios:215:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iosfwd:90:10: fatal error: 
      'wchar.h' file not found
#include <wchar.h>  // for mbstate_t
         ^
1 error generated.

有多种选择:

  • 尝试使用安装缺少的工具(如果有)xcode-select --install并尝试编译。如果失败的话,
  • 尝试跑步gcc -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk source.cpp。这显然假设您已在该位置安装了 SDK。替换为那里存在的任何位置。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

执行 a.out 文件时出现问题 (C++) MacOS Sierra 10.12.1 的相关文章

随机推荐

  • 我可以通过java在我的系统上安装证书吗

    我可以通过java在我的系统上安装证书吗 像这样的东西例如 证书 证书 someClass getsystemCertificates 有没有可用的api 您可以使用keytool命令获取 cacerts 文件中的证书列表 该文件是 Jav
  • 使用较短的数组查询 IndexedDB 复合索引

    IndexedDB 允许您对多个属性创建索引 就像如果你有类似的物体 a 0 b 0 你可以建立索引a and b 复合索引的行为是很奇怪 但显然应该可以使用比复合索引短的数组进行查询 所以在我的示例中 我应该能够查询类似的内容 0 并得到
  • Django登录AttributeError:'AnonymousUser'对象没有属性'_meta'

    我有这个代码 from django contrib auth import logout login authenticate if User objects filter email email exists existing user
  • 更新时如何检查 Tensorflow 中梯度的 NaN?

    All 当您训练具有大量样本的大型模型时 某些样本在参数更新时可能会导致 NaN 梯度 我想找出这些样本 同时我不希望这批样本的梯度更新模型的参数 因为这可能会导致模型的参数为NaN 那么有人有解决这个问题的好主意吗 我的代码如下 Crea
  • 隐式删除默认构造函数与编译器不合成默认构造函数相同

    我正在学习 C 中的类 我才知道在某些情况可以隐式删除默认构造函数 另外 我读到 当我们有用户定义的构造函数时 编译器将不会自动合成默认构造函数 以我目前的理解 隐式删除默认构造函数与默认构造函数不自动合成时的情况有很大不同 我的意思是 在
  • 如果这个类没有 Dispose 方法,它如何实现 IDisposable?

    FtpWeb响应实现 IDisposable 但它没有 Dispose 方法 这怎么可能 它在基类WebResponse中实现 参见http msdn microsoft com en us library system net webre
  • 用于检查输入是否为整数的 C++ 修复[重复]

    这个问题在这里已经有答案了 例如 如果我输入 2a 它不会显示错误 也不会要求用户重新输入该值 我该如何解决 while std cin fail std cout lt lt ERROR enter a number lt lt std
  • 如何使用Guice的@Singleton?

    我需要创建某个类的一个实例 并且这个实例需要可以从代码中的任何位置访问 所以 我找到了 Guice 并且我想使用这个包中的 Singleton 但我没有找到任何示例或一些文档来说明如何使用它以及如何进行声明 Singleton 非常容易使用
  • Addhandler、button.click 未使用 VB.NET 触发

    我遇到了按钮和 AddHandler 的问题 仅当我在 Page load 中使用 AddHandler Button1 click AddressOf 时它才有效 但如果我在子例程之一中动态创建按钮 则该事件不会触发 例如
  • 在大图像中绘制边界框

    我有一个大的二值图像 4k x 7k 像素 我想从中提取整个黄色部分作为单个矩形 我尝试了二元腐蚀来均匀黄色区域内的特征 然后我用了bbox的方法skimage regionprops但对于带有一个大 bbox 的大图像来说 它似乎工作得不
  • 在 html 中创建不可见的文本字段?

    我正在尝试将 html 代码放入我老板提供的设计模型中 并且一些美学 例如搜索栏的形状 有点奇怪和复杂 作为一个简单的解决方案 我想我只需将一个文本字段放在搜索栏的图像上 但我无法让它工作 谁能建议一种方法 将文本字段分层在图像上 使其不可
  • R:根据嵌套组计算比例

    我正在使用 R 编程语言 我有以下数据集 set seed 123 library dplyr Patient ID 1 5000 gender lt c Male Female gender lt sample gender 5000 r
  • 尝试使用 PDO 更新记录

    我更新了问题代码 但仍然有问题 没有错误 但没有更新记录 还需要弄清楚如何写入记录 更新成功 我被困在这个更新页面了
  • 无法打开数据库-Android

    我正在使用 SQL 开发一个简单的 Android 应用程序 我遵循以下指南 http www reigndesign com blog using your own sqlite database in android applicati
  • 使用 AVCaptureSession 和 AVAssetWriter 翻转相机时无缝录音

    我正在寻找一种在前后摄像头之间切换时保持无缝音轨的方法 市场上的许多应用程序都可以做到这一点 一个例子是 SnapChat 解决方案应使用 AVCaptureSession 和 AVAssetWriter 此外 它不应该明确使用 AVMut
  • .Theninclude 用于 Entity Framework Core 2 中的子实体

    以前 使用 net 4 5 2 和 EF 6 时 我有一个通用的Get接受多个的方法包括如下 public abstract class DataContext IdentityDbContext
  • 获取特定时间范围内所有发生变化的文件

    Bash 中的一个非常基本的问题 但我似乎无法弄清楚 我正在寻找一个带有管道的单行命令 在 bash 中查找当前目录中上次在 13 15 到 13 30 之间更改的所有 py 文件 与日期无关 我想我可以用ls and cut但我不确定这是
  • Android - 从另一台设备访问 Google Drive appdata 文件夹,但应用程序相同

    我的应用程序设置为允许将备份保存到 Google Drive 应用程序数据文件夹 这一切在同一台设备上运行得非常好 当我进行备份时 删除应用程序的数据 然后恢复一切正常 但是 当我尝试在一台设备上备份 然后在另一台设备上安装并尝试恢复时 没
  • python opencv-寻找圆(太阳),图片中圆心的坐标

    我是新来的 也是编程方面的新手 我有一个问题 我有 16 位 bmp 文件中的太阳图片 图片看起来是黑色背景的白色圆圈 我想找到一个圆并在 x y 坐标中确定其中心 我有这个脚本 import cv import numpy as np o
  • 执行 a.out 文件时出现问题 (C++) MacOS Sierra 10.12.1

    我刚刚更新到 Sierra 似乎我的编译器由于某种原因崩溃了 我编写的代码在更新之前工作正常 所以我确信这不是问题 但现在当我尝试执行它时它就无法工作 这是输出 g source cpp a out dyld mach o but buil