3

我是 Xcode 的新手,所以还不太热衷于它。在我的大学里,Visual Studio 使用 C 语言进行编程,他们在其中创建解决方案并用应用程序填充它,然后包含带有 .h 和 .c 文件的静态库。一直在尝试在 Xcode 中执行此操作,但似乎无法像在 Visual Studio 中那样包含它们或添加依赖项

4

1 回答 1

0

One approach is just using the standard gcc command line options for static library linking which you can specify using the XCode project settings. This will work if the static library is installed and accessible in the standard locations.

Alternatively you can add a static library explicitly to your project and set the dependencies and search paths for headers etc appropriately. This may sound a bit involved, but there's not really that much to do, and you only need to set it up once. It's all done in the same place as other project settings, and you can use the search box to find exactly where to enter the options.

I'm assuming you don't want to actually build the static library with your project. if you do there's more to do - basically you need to set up the static library project, set it as a target dependency, and setup a build step to copy the resulting library.

于 2012-11-07T05:46:37.570 回答