I also had quite a bit of pain with ZXing's dependencies. Here's some tips that will hopefully be of assistance to others with similar issues.
This line does an import:
#import <zxing/common/Counted.h>
For the compiler to find Counted.h
, the header search path must be specified.
Now, because the import
statement will look for Counted.h
relative to two subfolders zxing/common
, we need to give it the parent folder of zxing
.
In this case, the parent folder is going to be something like:
/ .. my full path here ../cpp/core/src/
So, under the src
directory you'll find zxing
.
How do we configure this in Xcode? Best to do it relatively. Otherwise, the project will fail on a different user's machine.
To do this, we specify a path relative to the project directory. As follows:
$(PROJECT_DIR)/../cpp/core/src
That goes in the Header Search Path of Build Settings for the ZXingWidget target.
The crucial thing with this header path stuff is to specify the relative directory to search from. In our case, we specify search relative to $(PROJECT_DIR)
. That variable specifies the directory of our subproject ZXingWidget
.
Other caveats. Be careful to specify these in the build settings of your target. If you do it at project level you'll still need to specify it at target level using the $(inherited)
variable.
Also, don't forget that the build transcript can be very useful. Look at the header paths included with the -I
flag.
As a general debugging technique, I like to specify the absolute path in my settings. That gives a clean build and I know that the files can be included, and where they definitely are. Having done that I then use the $(PROJECT_DIR)
to specify a relative path.