Objective-C 问题 - 类之前需要标识符或“(”

问题描述 投票:0回答:1

在我的头文件 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 ([email protected]), 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% 确信编译器会抛出错误,只是因为它感觉像这样。 你能找出问题所在吗?

objective-c
1个回答
2
投票

检查您的

DownloaderThread.h
文件。你可能在最后有一个错误。

或者,

GuiController.h
是从未编译为 Obj-C 或 Obj-C++ 的源文件导入的。尽管如果是这种情况(在导入的标头之一中),我预计会更快出现错误。

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.