Objective-C 问题 - 类前的预期标识符或'('



在我的头文件GuiController.h中:

#import <Cocoa/Cocoa.h>
#import <APPKit/NSTextField.h>
#import "ClientSocket.h"
#import "UploaderThread.h"
#import "DownloaderThread.h"
/**
 * SER 321 Foundations of Distributed Applications
 * see http://pooh.poly.asu.edu/Cst420
 * @author Christopher Sosa (smoothpinkjazz@gmail.com), ASU Polytechnic, Software Engineering
 * @version December 2012
*/
@class AppDelegate; //compiler error
@interface GuiController : NSObject {
    AppDelegate * appDelegate;
    NSSound *sound;
    NSString *port;
    NSString *host;
    ClientSocket *mainSock;
    ClientSocket *songSock;
    UploaderThread *uploader;
    int ident;
    NSTextField *albTB;
    NSComboBox *titCB;
    NSTextField *authTB;
}
- (id) initWithDelegate: (AppDelegate*) theDelegate
               host: (NSString*) hostName
               port: (NSString*) portNum;
- (void) dealloc;
- (void) saveLib;
- (void) restoreLib;
- (void) addMD;
- (void) removeMD;
- (void) refreshMD;
- (void) playMD;
- (void) comboBoxSelectionDidChange: (NSNotification*)notification;
- (void) debug: (NSString*) aMessage;
@end

我标记了引发错误的行,即使似乎没有错误。 我 99% 确定编译器只是因为它感觉像它而抛出错误。 你能找出问题所在吗?

检查您的DownloaderThread.h文件。最后你可能有一个错误。

或者,GuiController.h正在从未编译为 Obj-C 或 Obj-C++ 的源文件中导入。尽管如果是这种情况,我希望错误会更快(在其中一个导入的标头中)。

最新更新