Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to tell Xcode how to include a library specified with angle brackets?

I often see open source code importing third-party libraries in Xcode / Objective-C implementation files like this:

#import <ThirdPartyLibrary/utilities.h>

but when I drag & drop the file structure and files of such a library in my project, all these imports are corrupted and Xcode does not know where the files are.

I end up hand-modifying every import to look like:

#import "utilities.h"

And include appears it is relative to the current physical folder on the file system. When a library split its files in folders on file system and I drag-drop it in Xcode, Xcode creates groups for the folders. But for import, I have to specify the folder name. Problem is when I am in a folder, for example:

http/httpTools.h

Then when httpTools.h wants to import utilities.h from the root, I have to change

#import <ThirdPartyLibrary/utilities.h>

to

#import "../utilities.h"

which is a chore. After doing this for 5 hours I thought damn, there must be a better way. Can someone explain what is the secret to teaching Xcode a new framework location that can be imported with angle brackets? The framework btw is source code. Not compiled. Just the naked code.

like image 940
openfrog Avatar asked Aug 02 '13 21:08

openfrog


2 Answers

Specify the include path using the compiler flag -I, or the Xcode build settings alias HEADER_SEARCH_PATHS. Of course, you can use build variables when doing so.

like image 120
justin Avatar answered Nov 29 '22 08:11

justin


Just stumbled upon the same issue, there are two types of search paths in Xcode:

Header Search Paths
User Header Search Paths

If you add your own include folders into Header Search Paths, you can use angled brackets.

like image 38
fatihk Avatar answered Nov 29 '22 08:11

fatihk