views:

375

answers:

3

I'm wondering what decides whether you're allowed to use < > or " " when you're importing files in objective c. So far my observation has been that you use " " for the files in your project that you've got the implementation source to, and < > when you're referencing a library or framework. But how exactly does that work? What would I have to do to get my own classes to use < >? Because right now xCode will not allow me to do that for my own headers.

Also, by looking in some frameworks headers, I see that the headers reference eachother with <frameworkname/file.h>. How does that work? It looks alot like packages in Java, but as far as I know, there is no such thing as a package in objective c, is there? How would you go on about making your own framework?

+2  A: 

The difference is common with that in C/C++ in that the quoted form is for 'local' include files (you need to specify the relative path from the current file, e.g. #include "headers/my_header.h"), while the angle-bracket form is for 'global' include files - those found somewhere on the include path passed to the compiler (e.g. #include <math.h>).

So to have your own headers use < > not " " you need to pass either the relative path or the absolute path to your headers directory to the compiler. See this question for info on how to do that in XCode

See this MSDN page for more info

Mark Pim
A: 

Howdy!

To import your onw classes using "< >" you have to put the header files (*.h) in the lib folder of compiler or set a SYSTEM VARIABLES ponting to your lib folder.

Rigo Reis
A: 

In C the convention is that header files in <> bracket are searched in 'system' directories and "" in user or local directories.

The definition of system and local is a bit vague I guess. I believe it looks in system directories in include path or in CPPFLAGS for and local directory or directory specified with -I to compiler are searched for "header.h" files.

I assume it works similarly for Objective-C.

stefanB