开发者

Upgraded to Xcode 4 -- Endless stream of duplicate symbol errors causing build errors

开发者 https://www.devze.com 2023-02-16 08:49 出处:网络
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

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 ha开发者_如何学Pythons any advice, id be more than happy to give it a try. Thanks!


I just ran into a similar problem and resolved it by editing my build settings:

  1. Choose the Project Navigator from the navigator list at left (⌘-1).
  2. Select your project file.
  3. Select your the target from the list that appears in the editor area.
  4. Switch to the Build Phases tab.
  5. Check Link Binary with Libraries and/or Compile Sources for the duplicated library.

Now, I am not using the same library or project configuration, so this may be way off-base.


Make sure that you're not importing .m files.

This mistake caused endless problems for me.


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


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消