在 Xcode 中构建和使用 DYLIB [英] Building and Using a DYLIB in Xcode

查看:25
本文介绍了在 Xcode 中构建和使用 DYLIB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 Xcode 中构建一个 .dylib.当前 .dylib 构建,但是当我将 .dylib 拖入另一个项目并尝试 #import .dylib 中的一个标头 (Seeker.h) 时,我收到此错误:

I'm trying to build a .dylib in Xcode. Currently the .dylib builds, but when I drag the .dylib into another project and try to #import one of the headers (Seeker.h) in the .dylib, I get this error:

*:没有那个文件或目录
Seeker.h:没有那个文件或目录

*: No such file or directory
Seeker.h: No such file or directory

该项目可用作 Xcode 项目此处.

The project is available as an Xcode project here.

我可以确认标题确实在构建后的 .dylib 旁边的路径中,但至于如何处理它,我不知道.我对 .dylib 文件的唯一体验是内置于 Mac OS X 中的框架,例如 libsqlite3.dylib,它运行良好.我能在 .dylib 文件上找到的所有教程都没有涵盖如何以合理的方式在 Xcode 中使用它们;所有这些都依赖于复杂的脚本或依赖于机器的配置,这对我们不起作用.

I can confirm the header is indeed in a path alongside the .dylib once built, but as for what to do with it I have no idea. My only experience with .dylib files is frameworks built into Mac OS X, like libsqlite3.dylib, which works perfectly. All the tutorials I can find on .dylib files does not cover how to use them with Xcode in a sensible manner; all of them rely either on complex scripts or machine-dependent configuration which will not work for us.

所以基本上我需要一个从头到尾的分步过程,成功构建 .dylib 并成功以某种方式将它包含在另一个 Xcode 项目中这不依赖于为不同用户更改构建设置.换句话说,这是一种行之有效的方式,当我们将两个项目分发给团队成员时也会奏效.

So basically I need a start-to-finish step-by-step process that successfully builds the .dylib and successfully includes it in another Xcode project in a way that's not dependent on changing build settings for different users. In other words, a way that just works and that will work when we distribute both projects to members of our team.

推荐答案

Dylib 不带有标题:它们是无脑的可执行文件.内置库的头文件位于已知位置,例如 /usr/include,这使得它们在全球范围内可用.您正在寻找的可能是一个框架.

Dylibs don't carry headers: they're brainless executable files. Built-in libraries have their headers in known locations, like /usr/include, which makes them globally available. What you're looking for is probably a framework.

框架是包含动态库和头文件的包,因此一旦与框架链接,您就可以导入它具有的头文件.它还可以承载图像和声音等其他资源.

Frameworks are packages that contain a dynamic library and header files, so once you link with the framework you can import the headers it has. It can also carry other resources such as images and sounds.

我建议你阅读 框架编程指南了解更多信息.

I suggest you read the Framework Programming Guide for more informations.

这篇关于在 Xcode 中构建和使用 DYLIB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆