autoreleasepool 未在此范围内声明错误

2024-04-01

我的项目是 XCode 4.2。该项目编译为常规调试版本。

但是当我将构建类型更改为分析(我想分析内存使用情况)时,我从这个 Objective-C++ C++ 类中收到错误:

/Volumes/mchinen/scm/Voicer/FilterAudioMixer.mm:53:错误:杂散“@” 在程序 /Volumes/mchinen/scm/Voicer/FilterAudioMixer.mm 中: 在成员中 函数“void FilterAudioMixer::WriteToBuffer(SInt16*, int)”: /Volumes/mchinen/scm/Voicer/FilterAudioMixer.mm:53:错误: 'autoreleasepool' 未在此范围内声明 /Volumes/mchinen/scm/Voicer/FilterAudioMixer.mm:53:错误:预期;' before '{' token /Volumes/mchinen/scm/Voicer/FilterAudioMixer.mm:147: error: expected }' 在输入末尾

下面的 @autoreleasepool 行是第 53 行:

void FilterAudioMixer::WriteToBuffer(SInt16* buffer, int nb_samps)
{
   @autoreleasepool {
      //do a per element lock (todo)
      pthread_mutex_lock(&playlist_lock);
      FilterSound *snd;

      size_t count = playlist.size();
      for (size_t i = 0; i < count; i++) {
         snd = playlist[i];
         [snd writeToBuffer:buffer samples:nb_samps];
      }
      pthread_mutex_unlock(&playlist_lock);

      if (m_mute) {
         memset(buffer, 0, sizeof(SInt16) * 2 * nb_samps);
      }
   }
}

@autoreleasepool 似乎只在配置文件下给我带来问题,为什么呢?

为了完整起见,以下是构建结果窗口中的编译行:

编译C /Users/mchinen/Library/Developer/Xcode/DerivedData/Voicer-aebonlzraugcbqarecvubzkhxlfr/Build/Intermediates/Voicer.build/Release-iphoneos/Voicer.build/Objects-normal/armv7/FilterAudioMixer.o FilterAudioMixer.mm 正常armv7 Objective-C++ com.apple.compilers.llvmgcc42 cd /Volumes/mchinen/scm/Voicer setenv LANG en_US.US-ASCII setenv PATH“/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/ usr/sbin:/sbin" /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-gcc-4.2 -x Objective-C++ -arch armv7 -fmessage-length=0 -pipe -Wno-trigraphs -fpascal-strings -Os -Wreturn-type -Wunused-variable -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS .platform/开发者/SDKs/iPhoneOS5.0.sdk -gdwarf-2 -fvisibility=hidden -fvisibility-inlines-hidden -mthumb -miphoneos-version-min=4.0 -iquote /Users/mchinen/Library/Developer/Xcode/DerivedData/Voicer-aebonlzraugcbqarecvubzkhxlfr/Build/Intermediates/Voicer.build /Release-iphoneos/Voicer.build/Voicer- generated-files.hmap -I/Users/mchinen/Library/Developer/Xcode/DerivedData/Voicer-aebonlzraugcbqarecvubzkhxlfr/Build/Intermediates/Voicer.build/Release-iphoneos/Voicer.build/Voicer-own-target-headers.hmap -I/Users/mchinen/Library/Developer/Xcode/DerivedData/Voicer-aebonlzraugcbqarecvubzkhxlfr/Build/Intermediates/Voicer.build/Release-iphoneos/Voicer.build/Voicer-all-target-headers.hmap -iquote /Users/mchinen/Library/Developer/Xcode/DerivedData/Voicer-aebonlzraugcbqarecvubzkhxlfr/Build/Intermediates/Voicer.build/Release-iphoneos/Voicer.build/Voicer-project-headers.hmap -我引用。 -iquotePictures -iquoteCocoaSoundCloudUI -iquoteCocoaSoundCloudAPI -iquoteOHAttributedLabel -iquoteOAuth2Client -iquoteVoicer.xcworkspace -iquoteClasses -iquotehelp -iquoteJSONKit -iquoteShaders -iquoteaudio -iquotePictures/extremeprogrammingpics -iquotePictures/2010 -iquotePictures/网络摄像头 -iquotePictures/2011 -iquotePictures/gui -iquoteCocoaSoundCloudUI/SoundCloud.bundle -iquoteCocoaSoundCloudUI/Sources -iquoteCocoaSoundCloudAPI/Sources "-iquoteOHAttributedLabel/AttributedLabel 示例" -iquoteOHAttributedLabel/OHAttributedLabel -iquoteOAuth2Client/Sources -iquoteVoicer.xcworkspace/xcuserdata -iquoteJSONKit/JSONKit -iquoteaudio/CAExtras -iquotePictures/2010/06 -iquotePictures/2010/07 -iquotePictures/2010/08 -iquotePictures/2011/12 - iquote图片/2011 /10 -iquotePictures/2011/11 -iquotePictures/2011/09 -iquotePictures/2011/07 -iquotePictures/2011/08 -iquotePictures/gui/rec -iquotePictures/gui/buttonentity -iquoteCocoaSoundCloudUI/Sources/CocoaAdditions -iquoteCocoaSoundCloudUI/Source s/SoundCloudUI -iquoteCocoaSoundCloudAPI/Sources/SoundCloudAPI "-iquoteOHAttributedLabel/AttributedLabel 示例/类" -iquoteOAuth2Client/Sources/OAuth2Client -iquoteVoicer.xcworkspace/xcuserdata/mchinen.xcuserdatad -iquotePictures/2010/06/25 -iquotePictures/2010/07/22 -iquotePictures/2010/07/18 -iquotePictures/2010/08/25 -iquotePictures /2010/08/29 -iquotePictures/2010/08/07 -iquotePictures/2010/08/03 -iquotePictures/2011/12/16 -iquotePictures/2011/12/14 -iquotePictures/2011/12/17 -iquotePictures/2011 /12/15 -iquotePictures/2011/10/26 -iquotePictures/2011/10/30 -iquotePictures/2011/10/21 -iquotePictures/2011/10/22 -iquotePictures/2011/10/13 -iquotePictures/2011/11 /18 -iquotePictures/2011/11/19 -iquotePictures/2011/09/26 -iquotePictures/2011/09/25 -iquotePictures/2011/09/01 -iquotePictures/2011/09/21 -iquotePictures/2011/09/07 -iquotePictures/2011/09/13 -iquotePictures/2011/09/19 -iquotePictures/2011/07/17 -iquotePictures/2011/08/30 -iquotePictures/2011/08/23 -iquotePictures/2011/08/29 -iquoteVoicer .xcworkspace/xcuserdata/mchinen.xcuserdatad/xcdebugger -I/Users/mchinen/Library/Developer/Xcode/DerivedData/Voicer-aebonlzraugcbqarecvubzkhxlfr/Build/Products/Release-iphoneos/include -I/Users/mchinen/Library/Developer/Xcode/DerivedData/Voicer-aebonlzraugcbqarecvubzkhxlfr/Build/Intermediates/Voicer.build/Release-iphoneos/Voicer.build/DerivedSources/armv7 -I/Users/mchinen/Library/Developer/Xcode/DerivedData/Voicer-aebonlzraugcbqarecvubzkhxlfr/Build/Intermediates/Voicer.build/Release-iphoneos/Voicer.build/DerivedSources -F/Users/mchinen/Library/Developer/Xcode/DerivedData/Voicer-aebonlzraugcbqarecvubzkhxlfr/Build/Products/Release-iphoneos -DNS_BLOCK_ASSERTIONS=1 -include /Users/mchinen/Library/Developer/Xcode/DerivedData/Voicer-aebonlzraugcbqarecvubzkhxlfr/Build/Intermediates/PrecompiledHeaders/Filter_Prefix-hbhtwvzcunnlquaijtkwxcnrmocg/Filter_Prefix.pch -c /Volumes/mchinen/scm/Voicer/FilterAudioMixer.mm -o /Users/mchinen/Library/Developer/Xcode/DerivedData/Voicer-aebonlzraugcbqarecvubzkhxlfr/Build/Intermediates/Voicer.build/Release-iphoneos/Voicer.build/Objects -正常/armv7/FilterAudioMixer.o


该构建日志的重要部分是:

gcc-4.2

您的构建设置中的某些内容导致您使用旧的 GCC 4.2 编译器,该编译器不支持@autoreleasepool。 (更多解释见这个答案 https://stackoverflow.com/questions/6381764/xcode-4-2-compiler-error.)

在您的方案中,检查“Profile”正在使用什么构建配置。然后,检查项目中的设置以及该构建配置的目标。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

autoreleasepool 未在此范围内声明错误 的相关文章

  • 如何使用最新的 FBSDK 在 iOS 应用程序中集成 Facebook,而不重定向 Safari 浏览器

    您好 我正在搜索避免新的 facebooksdk 重定向到 safari 的答案 如何在应用程序内打开 facebook 登录视图 如果它重定向到 safari 可能会在应用程序商店中拒绝 帮助我 提前致谢 昨天我使用以下方式提交我的应用程
  • 为什么这段代码不能产生正确的输出? [关闭]

    很难说出这里问的是什么 这个问题是含糊的 模糊的 不完整的 过于宽泛的或修辞性的 无法以目前的形式得到合理的回答 如需帮助澄清此问题以便重新打开 访问帮助中心 help reopen questions 给定一个字符串和一个数字 该函数将从
  • 如何在 Mac 操作系统中播放声音?

    我想在专为 Mac OS X Lion 10 7 而不是 iPhone 设计的 Objective C 应用程序中播放 mp3 文件 谢谢 看看NSSound http developer apple com library mac doc
  • 获取选定行 NSTableView 的值

    我如何获取 NSTableView 中选定行的值 通过使用selectedRow see here https developer apple com documentation appkit nstableview 1535010 sel
  • 迭代 NSDictionary 时保持顺序

    我有一个 NSDictionary 它正在迭代并将数据保存到核心数据 如下所示 NSDictionary details valueDict objectForKey shipment master for NSDictionary res
  • 如何使用 NSWorkspace launchApplicationAtURL?

    我尝试使用以下命令运行 TextMate foo txt 的等效项在 URL 处启动应用程序 二进制文件的名称是 TextMate 我有一个参数 我尝试了以下代码 但它似乎不起作用 find the textmate NSURL bURL
  • 如何在全屏视图前面显示 NSPanel?

    我的应用程序以全屏方式运行 我需要类似 iOS 的 UIPopoverController 之类的东西 第一个想法是使用 NSPanel 但我无法让它显示在全屏视图前 我需要一个类似 UIPopoverController 的 Cocoa
  • 读取 DOMDocument 并使用 CSS 选择器查找元素

    我必须将 Android 应用程序转换为 iOS 该应用程序深入使用了jsoup http jsoup org 图书馆和element select cssQuery http jsoup org apidocs org jsoup nod
  • -[NSCFString objectAtIndex:]:无法识别的选择器

    我有一个小问题 在谷歌中找不到 UITableView工作正常 直到我开始滚动 Error Message NSCFString objectAtIndex unrecognized selector sent to instance 0x
  • 调用 popToRootViewControllerAnimated 时未调用 viewWillDisappear

    我从事遗留应用程序的工作 并发现我的view Will Did Disappear方法并不总是被正确触发 情况是 我有一个 自定义 UIViewController在 AppDelegate 中设置为 rootViewController
  • Xcode 6 Launchscreen.xib 具有适用于 iPad 横向和纵​​向的不同资源

    使用 Xcode 6 中引入的 LaunchScreen 我可以定义用于 iPad 横向和纵 向的不同资源吗 由于两个 iPad 方向的特征是相同的 遗憾的是 顺便说一句 我无法区分两者 这是否意味着 要么对 iPad 横向和纵 向使用相同
  • 如何在 XCode 中将 C++ 与 Objective-C 结合使用

    我想在 Objective C 中使用 重用 C 对象 我有一个包含类定义的 hello h 和用于类实现的 hello cpp class Hello int getX 我在 Objective C 函数中使用这个类 include he
  • UISearchBar 在单击时修改其框架/边界

    我正在尝试将 UISearchController 放置在我的应用程序 UI 中 布局是 黄色 ViewController 红色 另一个 ViewController 黑色 YellowViewController 中的容器 我想将 UI
  • UITableview Commit EditingStyle 具有多个按钮? [关闭]

    Closed 这个问题不符合堆栈溢出指南 help closed questions 目前不接受答案 如何在 UITableview 提交编辑样式中添加多个按钮 我需要显示一个带有删除按钮的更多按钮 由于无法使用公共API 所以你可以更好地
  • RestKit:BOOL 值

    我有一个NS ENUM保存清单的状态 这两个属性是Pending and Completed typedef NS ENUM NSUInteger ChecklistStatus Pending Completed 我正在尝试获取状态并将其
  • 在屏幕外绘制 uiview

    我想创建一个 UIView 它在调用 ViewDidLoad 时位于屏幕外 但一旦调用某个函数 我就会将其动画显示到屏幕上 用于对 UIView 进行动画处理的代码很好 但我似乎无法从屏幕外绘制 UIView 我已将故事板中的 UIView
  • UITextField:键盘出现时移动视图

    我目前正在开发一个具有单个视图的 iPhone 应用程序 该应用程序有多个 UITextFields 用于输入 当键盘显示时 它会覆盖底部的文本字段 所以我添加了相应的textFieldDidBeginEditing 方法 将视图向上移动
  • 在 Xcode 4.2 中启用崩溃日志符号

    我使用的是 Xcode 4 2 我的崩溃日志没有被符号化 如何在 Xcode 4 2 中启用此功能 请浏览苹果的文档 http developer apple com library ios technotes tn2151 index h
  • Siri - 联系人搜索行为类似于 Skype 的音频通话

    我正在实现一个 VoIP 应用程序 我需要通过 Siri 发起呼叫 我能够通过 Siri 发起呼叫 但问题是 每次启动应用程序时 尽管联系人不在应用程序的联系人列表中 我不知道如何以及在哪里处理这个问题 我的意思是 如果应用程序没有像 Sk
  • GameCenter 邀请处理程序

    尝试实现多人游戏 使用来自的样本游戏中心 发送和接收数据 https stackoverflow com questions 4574119 game center sending and receiving data 一切看起来都还好 但

随机推荐

  • Python读取时出现权限错误

    import os import rarfile file input Password List Directory rarFile input Rar File passwordList open os path dirname fil
  • 打开的连接数以及连接睡眠状态的含义

    我在我的数据库中运行了这个查询 SELECT DB NAME dbid as DBName COUNT dbid as NumberOfConnections loginame as LoginName FROM sys sysproces
  • 防止正文滚动(移动设备、本机浏览器)

    在 Samsung Galaxy S5 S6 的本机浏览器上 以下 CSS 片段 body overflow hidden 不会阻止主体滚动 有解决方法吗 编辑 如下所述 这也可以通过添加溢出 隐藏到 html 标签来完成 但这引入了窗口滚
  • 如何显示MapKit指南针?

    目前 指南针仅在以下情况下才会显示用户应用旋转手势 否则指南针将被隐藏 不过如果能实现我下面的两个愿望就好了 是否可以一直显示指南针 如何使用 Swift 显示 隐藏指南针视图 您可以在 iOS 11 中使用新功能轻松完成此操作MKComp
  • 一维字符串数组被角度资源解析为二维

    来自服务器的以下 JSON 响应 hello world 正在被 ngResource 服务解析为二维数组 myService factory Name function resource return resource site url
  • Perl 中的 my 和 local 有什么区别?

    我看到它们都用在我正在尝试调试的脚本中 但文献还不清楚 有人能为我揭开这个神秘面纱吗 简短的回答是my将变量标记为词法范围内的私有变量 并且local将动态范围内的变量标记为私有 更容易理解my 因为这会创建通常意义上的局部变量 创建了一个
  • 如何设置依赖gradle任务的属性

    我想设置一个 通用 任务 它将为多个平台构建应用程序包 它使用 javafxpackager 该任务的机制适用于创建所有平台捆绑包 但区别在于任务使用的各种属性 我原以为我会为每个平台创建单独的更高级别的任务 在其中设置平台特定的属性 然后
  • 检测ajax请求

    我正在编写自己的 MVC 框架来练习 并且我有一个 Request 类 我想捕获请求的类型并相应地解析数据 无论是 AJAX JSON 调用还是 HTML XML 请求 我目前使用 SERVER HTTP ACCEPT 以及上面使用 var
  • 了解 SQL Profiler 中的读/写次数

    请参阅此 SQL Profiler 视图中指示的 SQL 语句 所有这些事件都来自一台客户端计算机 该计算机正忙于长时间运行的进程 处理数千行 每次处理一行大约需要 6 5 秒 这是 SQL Profiler 显示的注销之间的时间 尽管实际
  • 如何删除python中的文件夹? rmtree 错误

    我最近遇到了这个麻烦 我需要一个功能来删除 Windows 中的整个文件夹 所以我进行了搜索 这就是我得到的 如何使用 Python 删除 删除不为空的文件夹 https stackoverflow com questions 303200
  • 无法从 IEnumerable 转换为 ICollection

    我定义了以下内容 public ICollection
  • 如何将 unique_ptr 的向量声明为类数据成员?

    我想要一个 unique ptr 的向量作为我正在创建的类的成员 class Foo private vector
  • 曲线与分段函数拟合?

    正如标题所示 我正在尝试用分段函数进行曲线拟合 这是一个例子 import numpy as np import scipy optimize as sio x np array 0 1 2 3 4 5 y np array 2 3 4 1
  • 如何使用 mpl_toolkits.basemap.cm 中的颜色图创建离散颜色条?

    当我绘制 pcolormesh 图时使用颜色图from matplotlib cm like jet Set2 等 我可以使用 cMap plt cm get cmap jet lut 6 颜色条显示如下 但是如果我想从Basemap包 如
  • 以编程方式打开 Apple Health

    是否可以像使用 设置 应用程序一样以编程方式打开 健康 应用程序 如果无法直接打开应用程序的 Apple Health 权限屏幕 我们至少可以打开 Apple Health 主屏幕吗 Edit 我知道我无法再次请求权限 就像相机访问等其他操
  • Jetty mysql 连接池配置错误:javax.naming.NameNotFoundException;剩余名称'env/jdbc/---(mysql 5.0+jetty 7.0.1)

    我的配置文件 项目 WEB INF web xml
  • 如何在 ActionScript 3 中从缓冲区(ByteArray/Stream)播放 MP3 声音?

    所以 我有一个MP3 数据缓冲区 如果我保存此缓冲区并将其命名为 buffer mp3 它就会播放 但在这种情况下我不应该将其保存到文件系统 我必须玩 但我不能 我该怎么办 我尝试了下一个代码来播放该缓冲区 ByteArray Stream
  • PHP DOTNET 地狱

    我是 PHP 的新手 今天我发现DOTNET http php net manual en class dotnet php class 所以我学习了手册 上网寻找一些例子 最后编写了我的测试应用程序 使用 Framework 4 0 Cl
  • PHP 初学者之类继承

    class User public company name class Employer extends User public fname public sname 这是我创建的 test php 我已经包含了类文件 employer
  • autoreleasepool 未在此范围内声明错误

    我的项目是 XCode 4 2 该项目编译为常规调试版本 但是当我将构建类型更改为分析 我想分析内存使用情况 时 我从这个 Objective C C 类中收到错误 Volumes mchinen scm Voicer FilterAudi