Reputation: 815
I have this problem with a library. I want to add it to my Objective C (iOS) project, but their docs don't say how to do that. I simply copied it over. Now their main file has this:
#include <LIB/Class1.h>
#include <LIB/Class2.h>
...
It didn't work for me, so I changed each <> to "":
#include "LIB/Class1.h"
#include "LIB/Class2.h"
...
And with this syntax everything works fine, I can use the lib. I guess it's not a good practice, though. How should I add a library to a project so that it works without this modification?
Upvotes: 1
Views: 821
Reputation:
ALWAYS_SEARCH_USER_PATHS
is deprecated now & should be avoided. Explicitly set
USER_HEADER_SEARCH_PATHS
for ".h"
include syntax header files.SYSTEM_HEADER_SEARCH_PATHS
for <.h>
include syntax header files.HEADER_SEARCH_PATHS
: for fallback of USER_HEADER_SEARCH_PATHS
for compilers which don't support separate include paths.https://help.apple.com/xcode/mac/current/#/itcaec37c2a6?sub=deved642222b
Upvotes: 0
Reputation: 13999
In Xcode Build Setting, Header Search Paths (HEADER_SEARCH_PATHS) affects search path of #include <foo.h>, User Header Search Paths (USER_HEADER_SEARCH_PATHS) affects search path of #include "foo.h".
So, set HEADER_SEARCH_PATHS for your library's header path, #include <LIB/Class1.h> should be work.
Also, Always Search User Paths (ALWAYS_SEARCH_USER_PATHS) setting can change behavior for search path #include <foo.h>. When ALWAYS_SEARCH_USER_PATHS is YES, #include <LIB/Class1.h> should be work as well.
Upvotes: 4
Reputation: 1
Add path to the libpath... "" relative from source and <>relative from the external libs
Upvotes: 0