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.
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.
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.
$(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.
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
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)"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With