Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

User Header Search Paths for Xcode

Tags:

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.

like image 359
lilzz Avatar asked Aug 24 '13 04:08

lilzz


People also ask

What are header search paths in Xcode?

Look at Preferences->Locations->"Custom Paths" in Xcode's preference. A path added here will be a variable which you can add to "Header Search Paths" in project build settings as "$cppheaders", if you saved the custom path with that name. Set HEADER_SEARCH_PATHS parameter in build settings on project info.

Where is library search paths in Xcode?

In the right pane, click the Build Settings tab, then scroll down to the Search Paths section, then enter the location of the iPhone simulator libraries in the Header Search Paths and Library Search Paths fields. $SRCROOT is a macro that expands to the directory where the Xcode project file resides.

What is Srcroot?

$(SRCROOT) (aka $(SOURCE_ROOT) ) is a path to your location where a . xcodeproj is. It is simple to check, just put it in a field and Xcode gives you a tip.


2 Answers

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
like image 80
Abizern Avatar answered Oct 16 '22 18:10

Abizern


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)"

like image 10
Kunal Khanna Avatar answered Oct 16 '22 16:10

Kunal Khanna