使用 dylib 中的类别来扩展二进制文件的类
我有一个 objc 应用程序,其中包含 Foobar 类,我想制作一个 dylib,它将在启动时加载到该应用程序中,并使用一些方法扩展 Foobar 类。
不幸的是,我无法构建该库,我收到以下链接器错误:
"_OBJC_CLASS_$_Foobar", referenced from:
__objc_const@0 in Foobar+MyStuff.o
__objc_classrefs__DATA@0 in Foobar+MyStuff.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
是否有一些链接器标志告诉 ld 忽略丢失的符号?
多谢!
I have an objc app that has the class Foobar and I want to make a dylib that will be loaded into that app on start and extends the class Foobar with a few methods.
Unfortunately I cannot build the library, I get the following linker error:
"_OBJC_CLASS_$_Foobar", referenced from:
__objc_const@0 in Foobar+MyStuff.o
__objc_classrefs__DATA@0 in Foobar+MyStuff.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
Is there some linker flag that tells ld to ignore that missing symbol?
Thanks a lot!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您将以下参数添加到目标的“其他链接器标志”部分,它将忽略缺少的符号并允许您执行您想要执行的操作。
PS:这是针对 Mac 的。不知道这如何或是否适用于 iPhone。
If you add the following arguments to the "Other Linker Flags" section of your target, it will ignore the missing symbols and allow you to do what you're trying to do.
PS: This is for the Mac. No idea how or if this applies to iPhone.