I created a static library which internally contains another static library (X) inside "Link Binary With Libraries" folder. But when I export my library to a sample project and try to compile it fails to locate the X library path. I am adding "." in the "Library search path" build parameter while building my static library.
What is that开发者_JAVA技巧 I am missing here?
If I understood your issue correctly, then it is less a linker-search-path problem but more a conceptual problem.
I see two options for solving the issue:
The common and straight-forward solution;
- add both static library projects into the project of your app
- expand the included projects
- expand the Targets of your app-project
- expand the "Link Binary With Libraries"-Entry
- drag the product files of your library projects (actual libraries) down into that "Link Binary With Libraries"-Entry
- include the header-path to both of your library-projects within your
USER_HEADER_SEARCH_PATHS
build settings
The next approach is rather unconventional and in most cases just not worth the extra mile. Here comes some explanation before going into the details.
The concept of a static library basically is a bunch of object-files stuffed into one single file (archive). Linking a static library against another static library is rather uncommon - well, to spell it out correctly, impossible.
...but then again, nothing is impossible when it comes to coding ;)...
The wrapper-library solution;
- use
ar
to extract all object files from all the libraries you want to combine - use
ar
to combine all those object files into one big, new library
ALong with setting up Header Search Path , Try setting up the Other Linkers Flag too..
Go to “Other Linker Flags” under the “Linker” section, and add “-ObjC” and “-all_load” to the list of flags
Hope that works for you,
精彩评论