lilzz
lilzz

Reputation: 5413

User Header Search Paths for Xcode

I have two paths that I want Xcode to search for headers:

"/myproject/lib1/include"
"/myproject/lib2/include"

What's the correct syntax for adding those two paths inside Xcode's User Header Search Paths? I tried "/myproject/lib1/include";"/myproject/lib2/include"

But it didn't work. It complained that object1.h not found. object1 is inside /myproject/lib1/include

I already added the whole /myproject/lib1/include folder and /myproject/lib2/include folder into the target project.

Upvotes: 26

Views: 53977

Answers (4)

user2095177
user2095177

Reputation: 1

Xcode 6.1.1 also requires you to set Search Paths->Always Search User Paths to 'Yes' ... and have User Header Search Paths as specified in above posts.

Upvotes: 0

Kunal Khanna
Kunal Khanna

Reputation: 561

Suppose you want to use your project directory, then you should use:

"$PROJECT_DIR" 

Double quotes are advised if your project path has spaces.

Enable recursive if you want to search within the folders as well. Alternatively, you can use "$(SRCROOT)"

Upvotes: 10

user2851386
user2851386

Reputation: 51

If you have multiple header paths, use SPACE to divide them, or double click the input text box of header pathS for advance setting. Another recommended way is search "User Header Search Paths" in your Xcode help menu.

Upvotes: 5

Abizern
Abizern

Reputation: 150715

Dd you actually put the leading /into the path? Because that's an absolute path and probably not what you mean.

You can pass it the relative location using $(SRCROOT) which expands the the directory containing the Xcode project file.

So, assuming your project file is in the myroject directory you should put this in your header search paths:

$(SRCROOT)/lib1/include
$(SRCROOT)/lib2/include

Upvotes: 32

Related Questions