我正在尝试编写这个头文件:
//@class AQPlayer;
//#import "AQPlayer.h"
@interface AQ_PWN_iPhoneViewController : UIViewController {
AQPlayer* player;
}
@end
AQPlayer是一个用C++编写的.mm文件。
我试图在这里进行类的前向声明,但它对我抱怨:
错误:找不到“AQPlayer”的接口声明
所以我尝试“#import”头文件,但它投诉了一些完全不同和奇怪的东西。这里是一个错误投诉的片段:
从文件中包含
/Users/akaraphan/Desktop/SpecialTopic1/AQ_PWN_iPhone/Classes/AQPlayer.h:51,
from /Users/akaraphan/Desktop/SpecialTopic1/AQ_PWN_iPhone/Classes/AQ_PWN_iPhoneViewController.h:12,
from /Users/akaraphan/Desktop/SpecialTopic1/AQ_PWN_iPhone/Classes/AQ_PWN_iPhoneAppDelegate.m:10:
/Developer/Examples/CoreAudio/PublicUtility/CAStreamBasicDescription.h:78: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'CAStreamBasicDescription'
/Developer/Examples/CoreAudio/PublicUtility/CAStreamBasicDescription.h:230: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
/Developer/Examples/CoreAudio/PublicUtility/CAStreamBasicDescription.h:231: error: expected '=', ',', ';', 'asm' or '__attribute__' before '==' token
/Developer/Examples/CoreAudio/PublicUtility/CAStreamBasicDescription.h:233: error: expected '=', ',', ';', 'asm' or '__attribute__' before '!=' token
/Developer/Examples/CoreAudio/PublicUtility/CAStreamBasicDescription.h:234: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<=' token
/Developer/Examples/CoreAudio/PublicUtility/CAStreamBasicDescription.h:235: error: expected '=', ',', ';', 'asm' or '__attribute__' before '>=' token
/Developer/Examples/CoreAudio/PublicUtility/CAStreamBasicDescription.h:236: error: expected '=', ',', ';', 'asm' or '__attribute__' before '>' token
/Developer/Examples/CoreAudio/PublicUtility/CAStreamBasicDescription.h:239: error: expected ';', ',' or ')' before '&' token
我有点不明白,我不能为这个做一个前向声明吗?
@class AQPlayer;
是针对 Obj-C 的,但你的方法调用player->StartQueue(false);
是 C++ 语法。 你要么需要在 C++ 中使用class AQPlayer;
,要么在 Obj-C 中使用[player startQueue:NO];
。 - Daniel Dickison