我的项目在 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 似乎只在配置文件下给我带来问题,这是为什么呢?
为了完整起见,这里是构建结果窗口中的编译行:
构建/Voicer-project-headers.hmap -iquote。-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。