Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XCode3 - relationship between Library Search Paths and project Frameworks

As a new MAc developer coming from VS I don't really 'get' what a framework is. If I add a framework to my project, does this automatically mean the headers should be found when I do #include <SomeFile.h>?

I seem to be finding in some cases I have to add header search paths as well. Does that mean the framework isn't working right?

like image 873
Mr. Boy Avatar asked May 03 '12 21:05

Mr. Boy


1 Answers

As defined by the Apple Conceptual Documentation:

A framework is a hierarchical directory that encapsulates shared resources, such as a dynamic shared library, nib files, image files, localized strings, header files, and reference documentation in a single package.

In other words, it is a compilation of resources that can be utilized by one or more applications, and it is not an application by itself.

Detailed by the Apple Conceptual Documentation:

You include framework header files in your code using the #include directive. If you are working in Objective-C, you may use the #import directive instead of the #include directive. The two directives have the same basic results. but the #import directive guarantees that the same header file is never included more than once. There are two ways for including framework headers:

#include <Framework_name/Header_filename.h>
#import <Framework_name/Header_filename.h>

In both cases, Framework_name is the name of the framework and Header_filename is the name of a header file in that framework or in one of its subframeworks.

When including framework header files, it is traditional to include only the master framework header file. The master header file is the header file whose name matches the name of the framework. For example, the Address Book framework has a master header file with the name AddressBook.h.

To include custom frameworks:

If your project links to frameworks that are not included in any of the standard locations, you must explicitly specify the location of that framework before Xcode can locate its header files. To specify the location of such a framework, add the directory containing the framework to the “Framework Search Paths” option of your Xcode project. Xcode passes this list of directories to the compiler and linker, which both use the list to search for the framework resources.

like image 140
Evan Mulawski Avatar answered Nov 02 '22 23:11

Evan Mulawski