升级到 Xcode 4 - 无休止的重复符号错误导致构建错误
昨天在我升级之前,Xcode 3 中的一切都工作得很好。所以我完成了升级,重新启动计算机,并打开我的旧项目。我必须重新配置一些设置,例如标头路径,以便我可以开始编译。我正在使用 AdWhirl 进行广告中介,此时我的错误开始显示类似“
duplicate symbol _OBJC_METACLASS_$_SBJSON in /Users/Admin/Desktop/TMapLiteAdwhirl/AdWhirl/MMSDK/libMMSDK.a(SBJSON.o) and
/Users/Admin/Library/Developer/Xcode/DerivedData/TruxMapLite-bgpylibztethnlhkfkdumpvrjvgy/Build/Intermediates/TruxMapLite.build/Debug-iphoneos/TruxMapLite.build/Objects-normal/armv6/SBJSON.o for architecture armv6
它所指的库是我在 AdWhirl 中包含的广告网络之一的 SDK”。两个“重复符号”都引用相同的文件,但它们使用不同的路径。如果我仍然有 XCode 3,我会简单地尝试从构建路径中排除这些库,但我不知道如何在 Xcode 4 中完成此操作。我已经尝试了所有方法,直到删除库和所有关联的我的项目中的文件,但是当我这样做时,我只会在 AdWhirl 目录中的不同库中得到相同类型的错误。
这是令人难以置信的令人沮丧,因为在升级之前一切都运行顺利,并且我准备提交我的二进制文件。如果有人有任何建议,我非常乐意尝试。谢谢!
Everything was working perfectly fine in Xcode 3 yesterday before I upgraded. So I completed the upgrade, restarted my computer, and opened my old project. I had to reconfigure a few settings like the header paths so that I could begin to compile. I'm using AdWhirl for ad mediation, and at this point my errors begin to read something like
duplicate symbol _OBJC_METACLASS_$_SBJSON in /Users/Admin/Desktop/TMapLiteAdwhirl/AdWhirl/MMSDK/libMMSDK.a(SBJSON.o) and
/Users/Admin/Library/Developer/Xcode/DerivedData/TruxMapLite-bgpylibztethnlhkfkdumpvrjvgy/Build/Intermediates/TruxMapLite.build/Debug-iphoneos/TruxMapLite.build/Objects-normal/armv6/SBJSON.o for architecture armv6
The library it's referring to is the SDK for one of the ad networks I'm including in AdWhirl. Both of the 'duplicate symbols' refer to the SAME FILE, but they use different paths. If I had still had XCode 3, I would simply try excluding these libraries from the build path, but I have no idea how that can be done in Xcode 4. I've tried everything all the way down to deleting the library and all associated files from my project, but when I do this, i will simply get the same type of error for a different library in the AdWhirl directory.
This is incredibly frustrating because before my upgrade everything was working smoothly and I was prepared to submit my binary. If anyone has any advice, id be more than happy to give it a try. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我刚刚遇到了类似的问题,并通过编辑构建设置解决了它:
Project Navigator
(⌘-1
)。在编辑器区域。
构建阶段
选项卡。将二进制文件与库链接
和/或编译源
以获取重复的库。
现在,我没有使用相同的库或项目配置,所以这可能是偏离基础的。
I just ran into a similar problem and resolved it by editing my build settings:
Project Navigator
from the navigator list at left (⌘-1
).in the editor area.
Build Phases
tab.Link Binary with Libraries
and/orCompile Sources
for theduplicated library.
Now, I am not using the same library or project configuration, so this may be way off-base.
确保您没有导入 .m 文件。
这个错误给我带来了无穷无尽的问题。
Make sure that you're not importing .m files.
This mistake caused endless problems for me.
我不确定您的设置,但我遇到了类似的问题,并通过更改构建位置来修复它。我在 xcode 3 中将其设置为绝对路径,但忘记在 xcode 4 中更改此设置。更改“派生数据”选项立即修复了我的所有错误。该选项位于首选项->位置
I'm not sure about your setup, but I had a similar problem and fixed it by changing my build location. I had set it to an absolute path in xcode 3, and forgot to change this setting in xcode 4. Changing the Derived Data option immediately fixed all my errors. This option is located in preferences->locations
我刚刚通过在我的一个类的头文件中用 #import 语句替换 @class 来解决这个问题。
理论上应该只适用于 @class 声明(以及实现中的 #import),只是不想编译时出现“重复符号”错误。
因此,请检查您的 @class 与 #import 语句。
I just fixed that problem by replacing @class with #import statement in header file for one of my classes.
What theoretically should work with only @class declaration (and #import in implementation counterpart) just didn't want to compile with "duplicate symbol" error.
So, review your @class vs. #import statements.
我发现我的源文件夹中有来自旧 Makefile 构建的旧目标文件。当我将源文件夹添加到 XCode 时,我不小心添加了源文件和目标文件。这导致了这些重复的符号错误。从我的源文件夹中删除 .o 和 .lo 文件有帮助。
我的源文件夹中还有一个来自另一个旧版本的 .libs 文件夹。其中也包含 .o 文件。删除它们解决了问题。
I found that I had old object files in my source folders from an old Makefile build. When I added the source folder to XCode I accidentally added both source and object files. That resulted in these duplicate symbol errors. Removing the .o and .lo files from my source folders helped.
There was also a .libs folder in my source folder from another old build. That contained .o files as well. Removing them solved the problem.