How to link my static .a library to a c Xcode(10.2.1) project

六眼飞鱼酱① 提交于 2021-01-29 10:53:58

问题


I have my own static c library eg. mylibrary.a , I have used it on a bunch of school projects from the terminal but I want to now use it with an Xcode(10.2.1) command line project for testing other projects.

I have tried putting the header file and .a file in the projects directory, adding the .a in the build phase menu under "link binary with libraries". I also tried linking it under "Other linker flags" by typing out my library's directory path. Thank you for your time.


回答1:


It's old but maybe will work for you:

  • Go to your Project's Build Phases
  • Click on the "+" under "Link Binary With Libraries" to add a new library. Then click on the "Add Other" button.
  • Navigate to the static library file (.a) and add it.

https://www.chilkatsoft.com/xcode-link-static-lib

And then you should add your directory Build Settings > Library Search Path

Note: Not the full path, just the directory.



来源:https://stackoverflow.com/questions/56847070/how-to-link-my-static-a-library-to-a-c-xcode10-2-1-project

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!