0

我的项目在 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。

4

1 回答 1

3

The important part of that build log is:

gcc-4.2

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.

于 2012-05-06T07:30:39.033 回答