My project is in XCode 4.2. This project compiles for a regular debug build.
我的项目是在XCode 4.2中。该项目编译用于常规调试构建。
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:
但是当我将构建类型更改为配置文件(我想要分析内存使用情况)时,我从这个objective-c ++ c ++类中得到错误:
/Volumes/mchinen/scm/Voicer/FilterAudioMixer.mm:53: error: stray '@' in program /Volumes/mchinen/scm/Voicer/FilterAudioMixer.mm: In member function 'void FilterAudioMixer::WriteToBuffer(SInt16*, int)': /Volumes/mchinen/scm/Voicer/FilterAudioMixer.mm:53: error: 'autoreleasepool' was not declared in this scope /Volumes/mchinen/scm/Voicer/FilterAudioMixer.mm:53: error: expected
;' before '{' token /Volumes/mchinen/scm/Voicer/FilterAudioMixer.mm:147: error: expected
}' at end of input/Volumes/mchinen/scm/Voicer/FilterAudioMixer.mm:53:错误:stogram'@'在程序/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:错误:预期;'在输入结束时'{'token /Volumes/mchinen/scm/Voicer/FilterAudioMixer.mm:147:error:expected}'之前
the @autoreleasepool line below is line 53:
下面的@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);
}
}
}
It would appear that @autoreleasepool is giving me problems only under profile, why is that?
似乎@autoreleasepool只在配置文件下给我带来问题,为什么会这样?
For completeness, here is the compile line from the build result window:
为了完整性,这是构建结果窗口中的编译行:
CompileC /Users/mchinen/Library/Developer/Xcode/DerivedData/Voicer-aebonlzraugcbqarecvubzkhxlfr/Build/Intermediates/Voicer.build/Release-iphoneos/Voicer.build/Objects-normal/armv7/FilterAudioMixer.o FilterAudioMixer.mm normal 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/Developer/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 -iquote. -iquotePictures -iquoteCocoaSoundCloudUI -iquoteCocoaSoundCloudAPI -iquoteOHAttributedLabel -iquoteOAuth2Client -iquoteVoicer.xcworkspace -iquoteClasses -iquotehelp -iquoteJSONKit -iquoteShaders -iquoteaudio -iquotePictures/extremeprogrammingpics -iquotePictures/2010 -iquotePictures/Webcam -iquotePictures/2011 -iquotePictures/gui -iquoteCocoaSoundCloudUI/SoundCloud.bundle -iquoteCocoaSoundCloudUI/Sources -iquoteCocoaSoundCloudAPI/Sources "-iquoteOHAttributedLabel/AttributedLabel Example" -iquoteOHAttributedLabel/OHAttributedLabel -iquoteOAuth2Client/Sources -iquoteVoicer.xcworkspace/xcuserdata -iquoteJSONKit/JSONKit -iquoteaudio/CAExtras -iquotePictures/2010/06 -iquotePictures/2010/07 -iquotePictures/2010/08 -iquotePictures/2011/12 -iquotePictures/2011/10 -iquotePictures/2011/11 -iquotePictures/2011/09 -iquotePictures/2011/07 -iquotePictures/2011/08 -iquotePictures/gui/rec -iquotePictures/gui/buttonentity -iquoteCocoaSoundCloudUI/Sources/CocoaAdditions -iquoteCocoaSoundCloudUI/Sources/SoundCloudUI -iquoteCocoaSoundCloudAPI/Sources/SoundCloudAPI "-iquoteOHAttributedLabel/AttributedLabel Example/Classes" -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-normal/armv7/FilterAudioMixer.o
CompileC /Users/mchinen/Library/Developer/Xcode/DerivedData/Voicer-aebonlzraugcbqarecvubzkhxlfr/Build/Intermediates/Voicer.build/Release-iphoneos/Voicer.build/Objects-normal/armv7/FilterAudioMixer.o FilterAudioMixer.mm normal 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 / Developer / SDKs / iPhoneOS5.0.sdk -gdwarf-2 -fvisibility = hidden -fvisibility-inlines-hidden -mthumb -miphoneos-version-min = 4.0 -iquote / Users / mchinen /库/开发商/ Xcode中/导出dData / Voicer-aebonlzraugcbqarecvubzkhxlfr / Build / Intermediates / Voicer.build / Release-iphoneos / Voicer.build / Voicer-generated-files.hmap -I / Users / mchinen / Library / Developer / Xcode / DerivedData / Voicer-aebonlzraugcbqarecvubzkhxlfr / Build /中间体/ 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 -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 Example”-iquoteOHAttributedLabel / OHAttributedLabel -iquoteOAuth2Client / Sources -iquoteVoicer.xcworkspace / xcuserdata -iquoteJSONKit / JSONKit -iquoteaudio / CAExtras -iquotePictures / 2010/06 -iquotePictures / 2010/07 - iquotePictures / 2010/08 -iquotePictures / 2011/12 -iquotePictures / 2011/10 -iquotePictures / 2011/11 -iquotePictures / 2011/09 -iquotePictures / 2011/07 -iquotePictures / 2011/08 -iquotePictures / gui / rec -iquotePictures / gui / buttonentity -iquoteCocoaSoundCloudUI / Sources / CocoaAdditions -iquoteCocoaSoundCloudUI / Sources / SoundCloudUI -iquoteCocoaSoundCloudAPI / Sources / SoundCloudAPI“-iquoteOHAttributedLabel / AttributedLabel Example / Classes”-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 / -27 -iquotePictures / 2010/08/03 -iquotePictures / 2010/12 / 16 -iquotePictures / 2011 / 12/14 -iquotePictures / 2011/12/17 -iquotePictures / 2011/12/ -idequotePictures / 2011/10/30 -iquotePictures / 2011/10/21 -iquotePictures / 2011/10/21 -iquotePictures / 2011/10 / 22 -iquotePictures / 2011/10/13 -iquotePictures / 2011/11/19 -iquotePictures / 2011/09/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-aebonlzra ugcbqarecvubzkhxlfr /生成/中间体/ Voicer.build /释放-的iPhoneOS / Voicer.build /对象 - 正常/ ARMv7的/ FilterAudioMixer.o
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.)
构建设置中的某些内容导致您使用旧的GCC 4.2编译器,该编译器不支持@autoreleasepool。 (在这个答案中有更多解释。)
In your scheme, check what build configuration "Profile" is using. Then, check the settings in your project and target for that build configuration.
在您的方案中,检查“Profile”正在使用的构建配置。然后,检查项目中的设置并定位该构建配置。
#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.)
构建设置中的某些内容导致您使用旧的GCC 4.2编译器,该编译器不支持@autoreleasepool。 (在这个答案中有更多解释。)
In your scheme, check what build configuration "Profile" is using. Then, check the settings in your project and target for that build configuration.
在您的方案中,检查“Profile”正在使用的构建配置。然后,检查项目中的设置并定位该构建配置。