Reputation: 345
I'm new to Objective-C here, and still learning its syntax, so I'm experimenting some things... and I'm trying to understand how the #import statement works when it comes to importing a file inside a folder.
I have a main function inside of a file and in the same directory of my main function contains a folder for a class, inside that folder I am trying to import a header file for that class.
I'm trying to import it like this:
#import "Person/person.h"
And I believe that should work but instead Xcode fires off a error saying it can not find the file/directory.
The folder that contains person.h is in the same directory as my main function's file. I still don't understand what's wrong with that piece of code, if someone can tell me the proper way to do this it would help a lot, thanks!
Upvotes: 2
Views: 4617
Reputation:
Try #import "person.h"
, the folder isn't really. It is a group, something like a virtual folder in the project, that let you organize visually your project files.
Upvotes: 5
Reputation: 104698
(one way) to use this functionality is to add the parent directory (of Person/
) to your target's include paths.
Upvotes: 1