I seem to be having a bit of trouble with using classes from other files in my interface. The way I have written it so far is…
#import "NodeBase.h"
@interface Node : NSObject {
@public
Node * testnode;
}
where NodeBase is a header file that deals with the importing of the other classes i.e.
#import <Foundation/Foundation.h>
#import "Node.h"
#import "NodeConnection.h"
#import "NodeProperty.h"
The error I am getting is a “Parse Issue: Expected a type”, is there no way to use a class in this context? Or have I got the syntax completely wrong?
Your
NodeBase.himportsNode.h, and yourNode.himportsNodeBase.h, creating a circular reference. This is not allowed.You can put everything in the
Node.hThen you can simply import
Node.hin places where you need to referenceNode*.If you would like to hide common imports (e.g.
<Foundation/Foundation.h>), you can put them intoSupportingFile/<Your-Project-Name>.pchfile.