What does it mean when you check on "Recursive" in Header Search Paths
Solution 1
If you give Xcode a path to use for headers, it will check that path when you use an #include
or #import
statement. If the file isn't there, it quits.
If you have the path set as "recursive", Xcode will search folders it finds there if it doesn't find the file.
Looks like this:
Solution 2
1) Enter your desired path for Header Search Paths, click enter.
2) Double click the path text that you entered.
3) On the right of the dialog box select recursive.
Solution 3
For those wondering, as I was, what the effect of choosing recursive
for a Header Search Path is on the compiler command line, it's to generate a -I
argument for every directory in the tree rooted at the given path. This can lead to very long compiler command lines which will make looking for anything else in there well nigh impossible. So it's worth considering how many directories are below the path you are specifying if you want to use recursive
.
I tried specifying -I../path/to/subproject/**
as a Compiler Flag for an individual file but that doesn't work (which is obviously why Xcode does the expansion itself).
(this is true for Xcode 9.4.1)
Solution 4
When you set a path
(e.g. Header Search Paths
, Library Search Paths
, Framework Search Paths
...) you can define a path to one of parent folder and set recursive
(/**
will be added to the end of the path). For example you can defile a path
to a include
directory(or more over to a Build
directory) with recursive
parameter instead of include/<target_name>
.
Please note: If the patch
contains spaces - , you should escape them using
\
or enclose the path in double quotes ""
Related videos on Youtube
Vincent Bacalso
Experienced iOS Developer with a demonstrated history of working in the information technology and services industry. Vincent Bacalso approaches work in the IT with a sense of quality like an artist. Strives to create more efficient workflows and a documentation nerd. Web Developer at Arcanys (2018-Present) Independent Contractor at TrustArc/CMIL (2018) iOS Developer at TrigID (2018) iOS Developer at Factnexus (2017-2018) Independent iOS Developer iOS Developer at Arcanys (2016-2017) iOS Apps Analyst at Truste now TrustArc (2015-2016) iOS Developer at OveractiveInk Cebu (2013-2016) Mobile Developer at NextIX Cebu, Philippines (2011-2013)
Updated on June 17, 2022Comments
-
Vincent Bacalso almost 2 years
I've been referencing a lot of Projects, and i do it through adding their paths in Header Search Paths.
I've been following the referencing stuffs through the "Referenced Project's" getting Started (like for example including the ZXingWidget).
And I've been doing it a lot now, but I don't understand the checking of recursive.
- What does this mean?
- When do I check a path for "recursive?"
Thanks
-
shim over 11 yearsBut how do you set it as "recursive"?
-
Almo over 11 yearsWhen you add a search path in the build settings, there's a box to check to set recursive.
-
shim over 11 yearsI don't see that. What I did do was add /** to the end of it. Does that do the same thing?
-
Almo over 11 yearsThere's an image of it here. iphoneincubator.com/blog/xcode/…
-
Hamy over 11 yearsFollowup: If your include uses folders e.g.
#include <boost/lambda/lambda.hpp>
then do you need to specify recursive or not? -
Almo over 11 yearsI would assume not, though I do not know for sure.
-
user124384 almost 9 yearsYou have to double click on the path, which brings up a window that has the "recursive" option. Utterly infurating and not intuitive, imo.
-
Albert Renshaw over 4 yearsFor future users, click "+" and enter
$(PROJECT_DIR)
as the value in the field, then set it to recursive, and it will crawl all folders to find your .h files. -
Albert Renshaw over 4 yearsUse this value as the search path to search ALL:
$(PROJECT_DIR)