首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >重复符号Apple Mach-O链接器错误

重复符号Apple Mach-O链接器错误
EN

Stack Overflow用户
提问于 2015-06-04 22:44:45
回答 1查看 555关注 0票数 1

我试图在一个iOS Swift项目中使用Google。

我用Python创建了Hello项目,并将其设置在AppEngine / https://cloud.google.com/appengine/docs/python/endpoints/

我按照下面的说明在我的项目上设置它:project,我也在使用Google+ API。

我被困在上面的第三步。为了方便起见,我在这里重新键入:

您的项目需要包括您以前运行的从foo_Sources.m生成的foo.h & ServiceGenerator文件,其中foo是您的API名称。这些文件不需要禁用ARC。

在XCode中,我将添加文件,并添加.h和.m文件。我还修改我的桥接头文件,并编辑我的构建设置头搜索路径,以包括正确的路径。

当我试图构建时,我会得到以下错误:

代码语言:javascript
运行
复制
Ld /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/WISE normal armv7
    cd /Users/rommelrico/Documents/GitHub/github.sandiego.edu/Mobile/WISEMobile
    export IPHONEOS_DEPLOYMENT_TARGET=8.1
    export 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/iPhoneOS8.3.sdk -L/Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Products/Debug-iphoneos -F/Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Products/Debug-iphoneos -F/Users/rommelrico/Documents/GitHub/github.sandiego.edu/Mobile/WISEMobile -filelist /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/WISE.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -dead_strip -ObjC -v -fobjc-arc -fobjc-link-runtime -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos -Xlinker -add_ast_path -Xlinker /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/WISE.swiftmodule -miphoneos-version-min=8.1 -framework QuartzCore -framework UIKit -framework SystemConfiguration -framework Security -framework MediaPlayer -framework CoreText -framework GooglePlus -framework CoreGraphics -framework CoreMotion -framework CoreLocation -framework Foundation -framework AssetsLibrary -framework GoogleOpenSource -framework AddressBook -Xlinker -dependency_info -Xlinker /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/WISE_dependency_info.dat -o /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/WISE

Apple LLVM version 6.1.0 (clang-602.0.49) (based on LLVM 3.6.0svn)
Target: arm-apple-darwin14.3.0
Thread model: posix
 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch armv7 -dead_strip -iphoneos_version_min 8.1.0 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk -ObjC -o /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/WISE -L/Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Products/Debug-iphoneos -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos -filelist /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/WISE.LinkFileList -rpath @executable_path/Frameworks -add_ast_path /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/WISE.swiftmodule -framework QuartzCore -framework UIKit -framework SystemConfiguration -framework Security -framework MediaPlayer -framework CoreText -framework GooglePlus -framework CoreGraphics -framework CoreMotion -framework CoreLocation -framework Foundation -framework AssetsLibrary -framework GoogleOpenSource -framework AddressBook -dependency_info /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/WISE_dependency_info.dat -framework Foundation -lobjc -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.1.0/lib/darwin/libclang_rt.ios.a -F/Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Products/Debug-iphoneos -F/Users/rommelrico/Documents/GitHub/github.sandiego.edu/Mobile/WISEMobile
duplicate symbol _OBJC_METACLASS_$_GTLHelloworldHelloGreeting in:
    /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/GTLHelloworldHelloGreeting.o
    /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/GTLHelloworld_Sources.o
duplicate symbol _OBJC_CLASS_$_GTLHelloworldHelloGreeting in:
    /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/GTLHelloworldHelloGreeting.o
    /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/GTLHelloworld_Sources.o
duplicate symbol _OBJC_CLASS_$_GTLServiceHelloworld in:
    /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/GTLHelloworld_Sources.o
    /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/GTLServiceHelloworld.o
duplicate symbol _OBJC_METACLASS_$_GTLServiceHelloworld in:
    /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/GTLHelloworld_Sources.o
    /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/GTLServiceHelloworld.o
duplicate symbol _OBJC_METACLASS_$_GTLQueryHelloworld in:
    /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/GTLHelloworld_Sources.o
    /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/GTLQueryHelloworld.o
duplicate symbol _OBJC_CLASS_$_GTLQueryHelloworld in:
    /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/GTLHelloworld_Sources.o
    /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/GTLQueryHelloworld.o
duplicate symbol _OBJC_METACLASS_$_GTLHelloworldHelloGreetingCollection in:
    /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/GTLHelloworld_Sources.o
    /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/GTLHelloworldHelloGreetingCollection.o
duplicate symbol _OBJC_CLASS_$_GTLHelloworldHelloGreetingCollection in:
    /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/GTLHelloworld_Sources.o
    /Users/rommelrico/Library/Developer/Xcode/DerivedData/WISE-cscxdkqblzamtvezakprtiqcthrm/Build/Intermediates/WISE.build/Debug-iphoneos/WISE.build/Objects-normal/armv7/GTLHelloworldHelloGreetingCollection.o
ld: 9 duplicate symbols for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我的观察

看起来,.m文件中的导入语句引起了问题。我正在为他们的SDK跟踪Google的文档,所以我想知道这是否是Swift/Objective的限制。我确实看到有人能在吉特布上设置它,不过:https://github.com/soundTricker/swift-cloud-endpoint-sample

这里是我的问题

  1. 为什么上面写着“架构armv7的9个重复符号”?我正在计算8条“重复符号”错误信息..。
  2. 在哪里添加"-v“以查看调用?
  3. 这些.o文件是什么?我需要修复的9个重复符号到底是什么?
  4. 我正在考虑一种解决这个问题的方法,就是用我的文件创建一个框架。这样,我只能将.h文件包含在我的项目中。这主意不好吗?

FYI:为了排除我的代码中的任何问题,我正在使用Google的代码,完全是从他们的Github存储库中克隆出来的。即使在一个干净的项目上,我也会遇到同样的问题。我正在使用Xcode v.6.3.1。

-Rommel。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-06-10 19:21:06

我解决了我的问题。Google生成一系列文件、实现和头文件,这些文件由Google声明添加到您的项目中。不幸的是,它还生成一个具有冲突导入语句的_Sources.m文件。我从我的iOS项目中删除了这个文件,并成功地构建了这个项目。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30655475

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档