ios 架构 armv7 的重复符号
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16427024/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
duplicate symbols for architecture armv7
提问by Paresh
Getting following error when try to use Layar SDK in my existing app. How can I solve this?
尝试在我现有的应用程序中使用 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)
回答by Adrian Bigland
This can happen if you accidentally #import
a .m
file instead of the .h
!
如果您不小心#import
使用.m
文件而不是.h
!
回答by Vishal
Generally, this kind of error occurs due to duplicate classes and xibs in your project folder. For example, in my project I had some class files duplicated(.h/.m files). You can see these duplicate classes under target->Build phases->compile sources
.
通常,这种错误是由于您的项目文件夹中的重复类和 xib 引起的。例如,在我的项目中,我复制了一些类文件(.h/.m 文件)。您可以在 下看到这些重复的类target->Build phases->compile sources
。
Just look and remove extra classes. Problem will be solved.
只需查看并删除额外的类。问题将得到解决。
回答by Jeff Lawson
Happens with static variables in a header file (header file included in more than one implementations file).
发生在头文件中的静态变量(头文件包含在多个实现文件中)。
回答by pulse4life
I was getting this error because I used the Xcode recommended warning flags. GCC_NO_COMMON_BLOCKS = YES was causing the issue. Setting this back to NO fixed it for me.
我收到此错误是因为我使用了 Xcode 推荐的警告标志。GCC_NO_COMMON_BLOCKS = YES 导致了这个问题。将此设置回 NO 为我修复了它。
回答by pom421
Be careful if you're using Cordova iOS 4.5.0
, an error of this kind may happen
使用时要小心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)
It can be due to the use of cordova-plugin-console
, which is not useful anymore in Cordova iOS 4.5.0
(and breaks the build too!).
这可能是由于使用了cordova-plugin-console
,它不再有用Cordova iOS 4.5.0
(并且也破坏了构建!)。
To fix it
要解决这个问题
cordova plugin remove cordova-plugin-console
See reference : https://cordova.apache.org/announcements/2017/09/08/ios-release.html
请参阅参考:https: //cordova.apache.org/announcements/2017/09/08/ios-release.html
回答by user2387149
This error can also be caused if you have cyclic imports.... lets suppose you have VC1.h
, VC2.h
, and VC3.h
如果您有循环导入,也可能导致此错误.... 假设您有VC1.h
, VC2.h
, 和VC3.h
examples that will cause the error:(all are the .h
files)
会导致错误的例子:(都是.h
文件)
- If VC2 imports
VC1
and VC1 importsVC2
- If VC1 imports
VC2
and VC2 importsVC3
and VC3 importsVC1
- 如果 VC2 导入
VC1
和 VC1 导入VC2
- 如果 VC1 导入
VC2
和 VC2 导入VC3
和 VC3 导入VC1
solution:
解决方案:
- import inside the
.m
instead of the.h
- if the
.h
needs that class use@class (nameOfClass);
instead of importing the.h
- 导入内部
.m
而不是.h
- 如果
.h
需要该类使用@class (nameOfClass);
而不是导入.h
Be careful when using#import
, only import what you need.
使用时要小心#import
,只导入你需要的。
回答by Envil
I have faced this problem once before. The reason is that I copied some methods and variables declared in the implementation body from one class to another. So rename these methods and moved these variable to the interface declaration area => solved.
我以前遇到过这个问题。原因是我将实现体中声明的一些方法和变量从一个类复制到另一个类。所以重命名这些方法并将这些变量移动到接口声明区域=>解决了。
回答by josephmisiti
I was seeing the same issue, but with different libraries. The fix was the following:
我看到了同样的问题,但有不同的库。修复如下:
Target -> Build Phases -> Linked Binary With Libraries
Make sure the libraries included make sense. In my case, my project had libPods*.a (I am using CocoaPods for dependency mgmt) but also a few libraries that were included in my pod shared libraries, and that was causing the duplicates.
确保包含的库有意义。就我而言,我的项目有 libPods*.a(我使用 CocoaPods 进行依赖管理),但也有一些包含在我的 pod 共享库中的库,这导致了重复。
回答by Ben Leggiero
My problem was... odd. I'm not sure how it happened, but at some point, Xcode decided to include some ancient .m
file one more time in its .pbxproj
file. The only way I found it was by comparing my changes in git, looking at the version of the code where the build first failed.
我的问题是……奇怪。我不确定它是怎么发生的,但在某个时候,Xcode 决定.m
在其.pbxproj
文件中再次包含一些古老的文件。我找到它的唯一方法是比较我在 git 中的更改,查看构建首次失败的代码版本。
回答by Anna Billstrom
I just fixed this error. I had CocoaPods installing a few frameworks (AWS, SDWebImage, AFNetworking. I manually dragged in 2 frameworks, Facebook and ImageIO. Most of my "duplicate symbol" errors were caught on Facebook classes. I deleted the framework and added it to the Podfile. Must have been an error or duplication in the libraries required by Facebook.
我刚刚修复了这个错误。我让 CocoaPods 安装了一些框架(AWS、SDWebImage、AFNetworking。我手动拖入了 2 个框架,Facebook 和 ImageIO。我的大部分“重复符号”错误都是在 Facebook 类中捕获的。我删除了框架并将其添加到 Podfile 中。肯定是 Facebook 要求的库中存在错误或重复。