How to add static libraries inside a C++ project with Xcode

后端 未结 1 1108
星月不相逢
星月不相逢 2020-12-10 04:39

I\'m developing a C++ project by using Xcode 4.6.1 as IDE. Now, I\'d like to add a static library mylib.a and the

相关标签:
1条回答
  • 2020-12-10 05:08

    Target dependencies is used if your static library is created by another XCode project and you want to include this project, so that you can easily develop on both you library and the corresponding application.

    If you want to include a foreign library you would select your target under TARGETS there you select the section Build Phases there you have the area Link Binary With Libraries into this area you would add your library either with drag & drop or with the + sign.

    To add the include path you select your project under PROJECT there you select the area Build Settings there you have under Search Path the Points Header Search Paths this should include the path to the directory where the header is.

    The difference between the settings in Project or Targets is that in Project it sets the default settings for all targets. In Targets you can change the settings per Target.

    EDIT For the linking errors this two answers could be helpful:

    • static Library in Xcode 4
    • file was built for archive which is not the architecture being linked (i386)
    0 讨论(0)
提交回复
热议问题