| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
Hi,
My code looks like this: -------------------------------- reader.h: #import <Cocoa/Cocoa.h>
@interface Reader: NSObject { struct FileHeader { int x; };
struct VarHeader { int x; };
struct FileHeader fh; struct VarHeader vh[1000]; }
-(void)Read;
@end ---------------------------------- reader.m: #import "reader.h"
@implementation Reader -(void)awakeFromNib { [self Read]; }
-(void)Read { int i; FILE* fp; fp = fopen("test.xxx","r"); fread(&fh,sizeof(FileHeader),1,fp);
... } ------------------------------------ Which gives me the following warnings and errors:
w: declaration does not declare anything (occurs after #import "reader.h")
e: "FileHeader" undeclared (first use this function) (after the fread statement)
I know that this code is supposed to work because it comes straight from the author. There must be something simple I'm overlooking, because it looks to me like I HAVE declared these things in the header. Is there some quirk about structure declarations in Obj-C? This code was originally in a .cpp file but I don't see anything here that should cause difficulties. If I replace sizeof(FileHeader) with sizeof(fh), the program will compile, although it still gives me the declaration warnings.
Hauke Klein
_______________________________________________ Do not post admin requests to the list. They will be ignored. Objc-language mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/objc-language/email@hidden
| References: | |
| >Declaration does not declare anything? (From: Mark Teagarden <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.