我正在嘗試創建一個iOS音頻項目,我需要使用XCode的Extras/CoreAudio/PublicUtility文件夾中提供的CARingBuffer類。 問題是當我在viewController的頭文件中包含CARingBuffer.h並且聲明瞭CARingBuffer對象時,我收到4個編譯錯誤。如何在iOS(iPhone,iPad)項目中使用CARingBuffer類?
重現我的問題很簡單。只需創建一個基於視圖的新應用程序,並在viewController的頭文件中#include「CARingBuffer.h」。
這裏是我的testViewController.h的內容:根據在CARingBuffer
#import "testViewController.h"
@implementation testViewController
- (void)dealloc
{
[super dealloc];
}
- (void)didReceiveMemoryWarning
{
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
#pragma mark - View lifecycle
/*
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
{
[super viewDidLoad];
}
*/
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
@end
婁位於(奇怪)4個編譯錯誤:
#import <UIKit/UIKit.h>
#include "CARingBuffer.h"
@interface testViewController : UIViewController {
}
@end
這裏是我的testViewController.m的內容XCode 4:
1)初始化元素不是線上常量:
const UInt32 kGeneralRingTimeBoundsQueueMask = kGeneralRingTimeBoundsQueueSize - 1;
2)預期';'後頂層聲明符,應爲 '=' ...或 '屬性附加傷害' 'CARingBuffer' 之前:
class CARingBuffer {
3)初始化器元件是不恆定的上一行:
const UInt32 kGeneralRingTimeBoundsQueueMask = kGeneralRingTimeBoundsQueueSize - 1;
4)預期';'之後頂層聲明符,預計 '=' ...或 'CARingBuffer' 前 '屬性附加傷害':
class CARingBuffer {
在此先感謝您的幫助。