重复的符号错误:SBJsonParser.o? [英] Duplicate Symbol Error: SBJsonParser.o?
问题描述
似乎重复的符号来自Amazon的AWS SDK文件AWSIOSSDK。这是它的样子:
该文件与ShareKit的文件libShareKit.a冲突。这是该文件的样子:
无论如何,这两个文件都是我以前没看过的文件。而且似乎有一些JSON文件在它们之间相互冲突。
我已经看过其他SO的问题,他们说使用编译的源做一些事情,但是这些文件都没有在任何一个库的编译源中。 >
这是Xcode给出的确切错误:
ld:重复的符号_OBJC_CLASS_ $ _SBJsonParser
无论如何,有没有人有任何想法我应该做什么?我的应用程序没有编译,除非我解决这个问题。
谢谢!
这两个都将 SBJsonParser
构建到其静态库中。这不是构建静态库的正确方法。每个应该建立没有 SBJson
,然后你应该链接所有它们与 SBJson
。有几个解决方案:
- 重建这些库(或让他们的维护者这样做)不要将第三方库直接包含在静态库。这是理想的解决方案。
- 从
.a $ c $中删除不正确的
SBJson
c>使用ar
的文件。您应该可以使用ar -t
来列出.a
中的对象,然后ar -d
删除那些不应该在那里的那些。您当然也可以ar -x
提取所有的.o
文件并直接链接。
I currently have ShareKit in my project that is compiled as a static library. It is properly implemented. I also have implemented Amazon's AWS SDK by just adding their framework into my project.
It seems that the duplicate symbol is coming from Amazon's AWS SDK file, "AWSIOSSDK". This is what it looks like:
And that file is colliding with ShareKit's file, libShareKit.a. This is what that file looks like:
Anyway both of these files are ones that I haven't seen before. And it seems that some JSON files are colliding within them.
I have looked at other SO questions and they say to do some things with the compiled sources but none of these files are in the compiled sources from either library.
Here is the exact error Xcode gives:
ld: duplicate symbol _OBJC_CLASS_$_SBJsonParser
Anyway, does anyone have any ideas what I should do? My app does not compile unless I fix this issue.
Thanks!
Both of these have built SBJsonParser
into their static libraries. This is not the correct way to build a static library. Each should build without SBJson
and then you should link all of them together with SBJson
. There are a couple of solutions:
- Rebuild these libraries (or have their maintainers do so) to not include third-party libraries directly into a static library. This is the ideal solution.
- Remove the incorrect
SBJson
files from the.a
files usingar
. You should be able to do this usingar -t
to list the objects in the.a
and thenar -d
to delete the ones that shouldn't be in there. You could of course alsoar -x
to extract all the.o
files and link them directly.
这篇关于重复的符号错误:SBJsonParser.o?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!