我想在我正在开发的一款cocos2d游戏中使用SimpleAudioEngine播放音乐。当我在我的游戏层导入SimpleAudioEngine.h时,在CVPixelBuffer.h和CMFormatDescription.h中得到语法错误。
我已经创建了一个新的干净的cocos2d应用程序并导入了SimpleAudioEngine,它工作得很好,因此错误出现在我的应用程序代码中。
你认为是什么导致了SimpleAudioEngine的错误?我该如何解决这个问题呢?
编辑:
看起来问题出在创建CVPixelBuffer时的size_t width。
在此代码中:
CV_EXPORT CVReturn CVPixelBufferCreate(CFAllocatorRef allocator,
size_t width,
size_t height,
OSType pixelFormatType,
CFDictionaryRef pixelBufferAttributes,
CVPixelBufferRef *pixelBufferOut) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_4_0);它为size_t width引发了错误,并表示:
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVPixelBuffer.h:183: error: expected ';', ',' or ')' before numeric constant发布于 2011-10-06 04:02:09
您是否已将CoreFoundation框架链接到您的项目?那#import <CoreFoundation/CoreFoundation.h>呢?我猜它找不到CFAllocatorRef符号。
https://stackoverflow.com/questions/7663789
复制相似问题