问题描述
我的项目在XCode 4.2中.该项目将编译为常规调试版本.
My project is in XCode 4.2. This project compiles for a regular debug build.
但是当我将构建类型更改为配置文件时(我想配置内存使用情况),我从这个Objective-C ++ C ++类中得到了错误:
But when I change the build type to profile (I want to profile memory usage), I get the error from this objective-c++ c++ class:
下面的@autoreleasepool行是第53行:
the @autoreleasepool line below is line 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似乎仅在配置文件下给我带来问题,为什么?
It would appear that @autoreleasepool is giving me problems only under profile, why is that?
为完整起见,这是构建结果窗口中的编译行:
For completeness, here is the compile line from the build result window:
推荐答案
该构建日志的重要部分是:
The important part of that build log is:
构建设置中的某些问题导致您使用旧的GCC 4.2编译器,该编译器不支持@autoreleasepool
. (此答案中的更多解释.)
Something in your build settings is causing you to use the old GCC 4.2 compiler, which doesn't support @autoreleasepool
. (More explanation in this answer.)
在您的方案中,检查正在使用的构建配置配置文件".然后,检查项目中的设置以及该构建配置的目标.
In your scheme, check what build configuration "Profile" is using. Then, check the settings in your project and target for that build configuration.
这篇关于在此范围错误中未声明autoreleasepool错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!