2

I have a project that uses cocoapods for some time. Recently, I bought an external library from a vendor. This library was sent to me as a static library (.a) and two headers files (.h).

I imported both files and added the static libraries Build Phases -> Link Binary With Librareis. However, my project can not find the static library.

The same library works fine on a project that does not use cocoapods (and workspace). So I think this is a compatibility problem with the configuration made by cocoapods. I've tried to add the static library path to Header Search Path and Library Search Path. No success.

Any suggestions?

3
  • Did you add the static library with the correct path and is it readable? Commented Dec 5, 2014 at 19:59
  • Yea! It's at the correct path and it's readable. Commented Dec 7, 2014 at 22:13
  • by the way, what is the error that arises during the build? Commented Dec 8, 2014 at 8:33

1 Answer 1

4

The standard procedure of adding library is

  1. add to OTHER LINKER FLAGS -l${name_of_library_without_LIB_prefix_and_.a_suffix}, for example libz.a will look like -lz
  2. add your library to the library search path. There are useful global vars

$(PROJECT_DIR)

$(SRCROOT)

You can reference it while defining path to your library

  1. add to the HEADER SEARCH PATH path to library headers. You can also use $(PROJECT_DIR) and $(SRCROOT) as a part of the path.

As for using external libraries with CocoaPods - there should be no difference apart from having $(inherited) as a first line of all this settings - library search path, header search path and other linker flags.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.