47

尝试在我现有的应用程序中使用 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)
4

16 回答 16

122

如果您不小心#import.m文件而不是.h!

于 2014-01-13T14:56:04.503 回答
87

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

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

于 2013-05-08T03:13:11.643 回答
52

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

于 2013-09-23T13:32:15.687 回答
19

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

于 2016-07-13T14:24:27.167 回答
7

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

将导致错误的示例:(都是.h文件)

  • 如果 VC2 进口VC1和 VC1 进口VC2
  • 如果 VC1 进口VC2和 VC2 进口VC3和 VC3 进口VC1

解决方案:

  • 在里面导入.m而不是.h
  • 如果.h需要该类使用@class (nameOfClass);而不是导入.h

使用时要小心 #import,只导入你需要的。

于 2014-02-07T20:07:13.750 回答
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

于 2017-09-13T15:40:04.737 回答
4

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

于 2014-05-01T09:40:21.213 回答
3

唯一对我有用的是删除我的 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
于 2020-03-07T03:45:48.737 回答
2

我看到了同样的问题,但使用了不同的库。修复如下:

Target -> Build Phases -> Linked Binary With Libraries

确保包含的库有意义。就我而言,我的项目有 libPods*.a(我使用 CocoaPods 来进行依赖管理),但也有一些库包含在我的 pod 共享库中,这导致了重复。

于 2015-10-09T16:31:07.927 回答
1

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

于 2015-01-27T02:33:12.780 回答
1

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

只需删除此行即可解决我的问题: 一个 git 变更集的示例,其中添加了一个文件并删除了零个文件。

于 2015-12-18T22:24:17.853 回答
0

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

于 2015-01-29T14:27:59.803 回答
0

Its because the iPhone simulator got duplicate .h & .m references. I struggled for hours for this bug.

My solution was simple. I copied the project to my pen drive and erased from computer memory.

Opened a new project, copied the storyboard and added the .h &.m files. Some errors fixed by selecting classes again in the storayboard view..

于 2015-05-11T05:50:12.910 回答
0

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

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

于 2017-10-16T11:01:59.977 回答
0

我也有重复的符号。我刚刚重命名了程序 (app -> app1, app2) 和相关的字段 app.XXX -> 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;
于 2016-04-19T23:04:43.400 回答
0

您可能安装了类似的插件。

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

  • 科尔多瓦插件电子邮件作曲家
  • 科尔多瓦插件电子邮件

通过使用...删除“cordova 插件电子邮件”来修复它

cordova plugin remove cordova-plugin-email

之后我跑了...

cordova prepare
cordova build ios

现在我的 xCode 构建运行起来就像一个魅力!呜呜呜!

于 2017-11-28T22:20:15.733 回答