架构armv7的重复符号

时间:2013-05-07 19:29:16

标签: iphone ios xcode arm duplicate-symbol

尝试在现有应用中使用Layar SDK时出现以下错误。我该如何解决这个问题?

Ld /Users/pnawale/Library/Developer/Xcode/DerivedData/hub-afxxzaqisdfliwbzxbixsaifljcl/Build/Products/Debug-iphoneos/hub.app/hub normal armv7
    cd /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub
    setenv IPHONEOS_DEPLOYMENT_TARGET 5.0
    setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -L/Users/pnawale/Library/Developer/Xcode/DerivedData/hub-afxxzaqisdfliwbzxbixsaifljcl/Build/Products/Debug-iphoneos -L/Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/ZBarSDK -L/Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/Infosound/Lib -L/Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/CrittercismSDK -L/Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub -L/Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/UserVoiceSDK-2.0.4 -L/Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/Libraries -F/Users/pnawale/Library/Developer/Xcode/DerivedData/hub-afxxzaqisdfliwbzxbixsaifljcl/Build/Products/Debug-iphoneos -F/Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub -filelist /Users/pnawale/Library/Developer/Xcode/DerivedData/hub-afxxzaqisdfliwbzxbixsaifljcl/Build/Intermediates/hub.build/Debug-iphoneos/hub.build/Objects-normal/armv7/hub.LinkFileList -dead_strip -ObjC -all_load -fobjc-arc -fobjc-link-runtime -miphoneos-version-min=5.0 -lMPOAuthMobile -lsbjson-ios -framework LayarSDK -framework Social -framework AddressBook -framework AddressBookUI -framework UIKit -framework QuartzCore -framework Twitter -framework SystemConfiguration -framework Security -framework OpenAL -framework OpenGLES -framework MessageUI -framework MediaPlayer -framework Foundation -framework CoreGraphics -lc++ -framework CoreTelephony -framework CoreVideo -framework CoreMotion -framework CoreMedia -framework CoreLocation -framework CoreData -framework CoreAudio -framework CFNetwork -framework AVFoundation -framework AudioToolbox -lxml2 -liconv -lz -framework MobileCoreServices -lzbar -linfosound -lCrittercism_v3_4_6 -lUserVoice -o /Users/pnawale/Library/Developer/Xcode/DerivedData/hub-afxxzaqisdfliwbzxbixsaifljcl/Build/Products/Debug-iphoneos/hub.app/hub

duplicate symbol _jpeg_free_large in:
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemansi.o)
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemname.o)
duplicate symbol _jpeg_free_small in:
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemansi.o)
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemname.o)
duplicate symbol _jpeg_get_large in:
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemansi.o)
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemname.o)
duplicate symbol _jpeg_get_small in:
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemansi.o)
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemname.o)
duplicate symbol _jpeg_mem_available in:
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemansi.o)
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemname.o)
duplicate symbol _jpeg_mem_init in:
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemansi.o)
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemname.o)
duplicate symbol _jpeg_mem_term in:
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemansi.o)
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemname.o)
duplicate symbol _jpeg_open_backing_store in:
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemansi.o)
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemname.o)
duplicate symbol _jpeg_free_large in:
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemansi.o)
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemnobs.o)
duplicate symbol _jpeg_free_small in:
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemansi.o)
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemnobs.o)
duplicate symbol _jpeg_get_large in:
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemansi.o)
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemnobs.o)
duplicate symbol _jpeg_get_small in:
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemansi.o)
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemnobs.o)
duplicate symbol _jpeg_mem_available in:
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemansi.o)
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemnobs.o)
duplicate symbol _jpeg_mem_init in:
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemansi.o)
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemnobs.o)
duplicate symbol _jpeg_mem_term in:
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemansi.o)
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemnobs.o)
duplicate symbol _jpeg_open_backing_store in:
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemansi.o)
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemnobs.o)
duplicate symbol _main in:
    /Users/pnawale/Library/Developer/Xcode/DerivedData/hub-afxxzaqisdfliwbzxbixsaifljcl/Build/Intermediates/hub.build/Debug-iphoneos/hub.build/Objects-normal/armv7/main.o
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jpegtran.o)
ld: 17 duplicate symbols for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

16 个答案:

答案 0 :(得分:121)

如果您不小心#import .m文件而不是.h,就会发生这种情况!

答案 1 :(得分:82)

通常,由于项目文件夹中的重复类和xib,会发生此类错误。例如,在我的项目中,我有一些类文件重复(.h / .m文件)。您可以在target->Build phases->compile sources下看到这些重复的类。

只需查看并删除额外的课程。问题将得到解决。

答案 2 :(得分:52)

在头文件中发生静态变量(头文件包含在多个实现文件中)。

答案 3 :(得分:19)

我收到此错误是因为我使用了Xcode推荐的警告标志。 GCC_NO_COMMON_BLOCKS = YES导致了问题。把它设置回NO修复它对我来说。

答案 4 :(得分:7)

如果您有循环导入,也会导致此错误....假设您有VC1.hVC2.hVC3.h

会导致错误的示例:(所有都是.h个文件)

  • 如果VC2导入VC1而VC1导入VC2
  • 如果VC1导入VC2且VC2导入VC3且VC3导入VC1

<强>溶液

  • 导入.m而不是.h
  • 如果.h需要该课程使用@class (nameOfClass);而不是导入.h

使用时要小心 #import ,只导入您需要的内容。

答案 5 :(得分:7)

如果您使用Cordova iOS 4.5.0时要小心,可能会发生此类错误

duplicate symbol _OBJC_METACLASS_$_CDVLogger in:
   /Users/toto/Library/Developer/Xcode/DerivedData/imp-hkzujazvkracgugyxunzwnzpeiqx/Build/Intermediates/imp.build/Debug-iphoneos/imp.build/Objects-normal/armv7/CDVLogger.o
   /Users/toto/Library/Developer/Xcode/DerivedData/imp-hkzujazvkracgugyxunzwnzpeiqx/Build/Products/Debug-iphoneos/libCordova.a(CDVLogger.o)

ld: 2 duplicate symbols for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

这可能是由于使用了cordova-plugin-console,这在Cordova iOS 4.5.0中不再有用(并打破了构建!)。

修复它

cordova plugin remove cordova-plugin-console

参见参考:https://cordova.apache.org/announcements/2017/09/08/ios-release.html

答案 6 :(得分:4)

我曾经遇到过这个问题。原因是我将实现主体中声明的一些方法和变量从一个类复制到另一个类。因此,重命名这些方法并将这些变量移动到接口声明区域=&gt;解决。

答案 7 :(得分:2)

我看到同样的问题,但是有不同的库。修复方法如下:

Target -> Build Phases -> Linked Binary With Libraries

确保包含的库有意义。在我的情况下,我的项目有libPods * .a(我使用CocoaPods作为依赖项mgmt),还有一些库包含在我的pod共享库中,这导致了重复项。

答案 8 :(得分:2)

对我唯一有用的是删除我的Podfile,然后重新安装。

在运行以下命令之前,请确保已复制所有原始Pod:

$ sudo gem install cocoapods-deintegrate

$ sudo gem install cocoapods-deintegrate cocoapods-clean

$ rm -rf ~/Library/Developer/Xcode/DerivedData

$ pod deintegrate

$ pod clean

$ rm Podfile

$ pod cache clean --all

$ pod init

// next add all the original pods to the new Podfile

$ pod install

答案 9 :(得分:1)

我刚修正了这个错误。我让CocoaPods安装了一些框架(AWS,SDWebImage,AFNetworking。我手动拖动了2个框架,Facebook和ImageIO。我的大多数“重复符号”错误都是在Facebook类上捕获的。我删除了框架并将其添加到Podfile中。必须是Facebook所需的库中的错误或重复。

答案 10 :(得分:1)

我的问题是......很奇怪。我不确定它是如何发生的,但在某些时候,Xcode决定在其.m文件中再次包含一些古老的.pbxproj文件。我发现它的唯一方法是比较我在git中的更改,查看构建首次失败的代码版本。

只需删除此行即可解决我的问题: A sample of a git changeset, with one file added and zero removed.

答案 11 :(得分:0)

我的Xcode中有重复的文件。物理上有一个m文件和一个h文件。但在项目中它加倍,导致编译源重复。 删除重复的m和h文件后问题解决了。

答案 12 :(得分:0)

因为iPhone模拟器重复了.h&amp; .m参考。我为这个错误挣了几个小时。

我的解决方案很简单。我将项目复制到笔式驱动器并从计算机内存中删除。

打开一个新项目,复制了故事板并添加了.h&amp; .m文件。通过在storayboard视图中再次选择类来修复一些错误..

答案 13 :(得分:0)

我也有重复的符号。我刚刚重命名了程序(app - &gt; app1,app2)和相关字段app.XXX - &gt; app1.XXX。它有效!

参见:(在.m文件中)

AppDelegate* app1;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
        app1 = (AppDelegate *)[[UIApplication sharedApplication] delegate];
    }
    return self;
}

(...)

- (int) getLimit
{
    if (app1.product2buyed)
        return MAXID;
    else if (app1.product1buyed)
        return 70;
    else
        return 10;

答案 14 :(得分:0)

请检查您是否添加了一次以上的任何框架,如果多次添加则删除所有框架,然后再拖放。

希望这能解决您的问题。 快乐的编码。

答案 15 :(得分:0)

你可能已经安装了类似的插件。

我正在使用Cordova,并且还有几个重复的符号错误。我安装了两个类似的插件:

  • cordova插件电子邮件编辑
  • cordova插件电子邮件

通过删除&#34; cordova插件电子邮件&#34;修复此问题。使用...

cordova plugin remove cordova-plugin-email

之后我跑了......

cordova prepare
cordova build ios

现在我的xCode构建就像一个魅力! Woooo Hooo!