如何将我的静态 .a 库链接到 c Xcode(10.2.1) 项目 [英] How to link my static .a library to a c Xcode(10.2.1) project
问题描述
我有自己的静态 c 库,例如.mylibrary.a ,我已经在终端的一堆学校项目中使用了它,但我现在想将它与 Xcode(10.2.1) 命令行项目一起使用以测试其他项目.
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.
我尝试将头文件和 .a 文件放在项目目录中,在链接二进制与库"下的构建阶段菜单中添加 .a.我还尝试通过键入我的库的目录路径将它链接到其他链接器标志"下.感谢您抽出宝贵时间.
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.
推荐答案
它很旧,但也许对你有用:
It's old but maybe will work for you:
- 转到项目的构建阶段
- 单击Link Binary With Libraries"下的+"以添加新库.然后点击添加其他"按钮.
- 导航到静态库文件 (.a) 并添加它.
https://www.chilkatsoft.com/xcode-link-static-lib
然后你应该添加你的目录 Build Settings
> Library Search Path
And then you should add your directory Build Settings
> Library Search Path
注意:不是完整路径,只是目录.
Note: Not the full path, just the directory.
这篇关于如何将我的静态 .a 库链接到 c Xcode(10.2.1) 项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!