Pink Jazz
Pink Jazz

Reputation: 802

Objective-C issue - expected identifier or '(' before class

In my header file 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

I marked the line that throws an error, even though there doesn't appear to be one. I am 99% sure the compiler is throwing the error just because it feels like it. Could you figure out the problem?

Upvotes: 1

Views: 576

Answers (1)

Lily Ballard
Lily Ballard

Reputation: 185681

Check your DownloaderThread.h file. You probably have an error at the end of it.

Alternatively, GuiController.h is being imported from a source file that is not compiled as Obj-C or Obj-C++. Although I'd expect an error much sooner if that was the case (in one of the imported headers).

Upvotes: 2

Related Questions