views:

717

answers:

2

Here is my header file

#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <PolygonShape.h>

@interface Controller : NSObject {
    IBOutlet UIButton *decreaseButton;
    IBOutlet UIButton *increaseButton;
    IBOutlet UILabel *numberOfSidesLabel;
    //IBOutlet PolygonShape *shape;
}
- (IBAction)decrease;
- (IBAction)increase;
@end

Here is my implementation file

#import "Controller.h"

@implementation Controller
- (IBAction)decrease {
    //shape.numberOfSides -= 1;
}

- (IBAction)increase {
    //shape.numberOfSides += 1;
}
@end

Why am I getting the following error on my #import "Controller.h" line?

error: PolygonShape.h: No such file or directory

The PolygonShape.h and .m files are in the same project and in the same directory as the Controller class.

+2  A: 

The angle braces (<>) mean that the file is in a standard include path, such as /usr/include or /System/Library/Frameworks. To import a file relative to the current directory, you need to use double-quotes like you do in #import "Controller.h".

Chuck
I though that too, but I just tried it with angle brackets on a local file and it seemed to work fine.
teabot
Thanks, that did it.
Jason
A: 

System header files use <>. Your header files should use "".

So it should be:

#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import "PolygonShape.h"

And you might want to use @class PolygonShape in your header file and do the import in your implementation.

Terry Wilcox