michael
michael

Reputation: 11

Objective c #import not linking to .h file

i am new to objective c programming and programming in general.

i am trying to find out how to add a subclass into a project.

i have two separate Xcode projects on my desktop in a single folder.

The Shapes [Folder] houses the two project folders: Rectangle Project & Square Project

-- Rectangle Project consists of:

`Rectangle.h` [interface]

`Rectangle.m` [implementation]

`Rectangle Project.m` [main]

@interface Rectangle : NSObject

-- Square Project consists of:

`Square.h` [interface]

`Square.m` [implementation]

`Square Project.m` [main]

@interface Square : Rectangle

I want to import the rectangle.h file from the rectangle project into the square project in the square.h file.

In my Square.h file I am adding the following:

#import <Cocoa/Cocoa.h>
#import <Foundation/Foundation.h>
#import "Rectangle.h"

@interface Square : Rectangle 

...I keep getting the error message: Rectangle: No such file or directory.

How do I get objective c to recongnize the file?

I hope i'm making sense...

thanks.

Upvotes: 0

Views: 130

Answers (1)

Evan Mulawski
Evan Mulawski

Reputation: 55334

You need the ".h":

#import "Rectangle.h"

just like:

#import <Cocoa/Cocoa.h>

Upvotes: 3

Related Questions