2012-12-11 39 views
1

在我的頭文件GuiController.h前:Objective-C的問題 - 期望標識符或「(」

#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%肯定,只是因爲感覺它的編譯器引發錯誤。你能找出問題?

+0

.m文件的外觀如何? –

+0

嘗試導入AppDelegate.h? –

+0

@PeterWarbo使用'@ class'的目的是避免導入.h文件。 – rmaddy

回答

2

檢查DownloaderThread.h文件。你可能在它結束時有一個錯誤。

或者,GuiController.h正在從源中導入未編譯爲Obj-C或Obj-C++的e文件。雖然如果是這種情況(在其中一個導入的頭文件中),我希望得到更快的錯誤。

+0

我想通了。它在UploaderThread.h和DownloaderThread.h中缺少@ end。我是Obj-C的新手,所以我不習慣語法。 –