问题
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