1

我正在使用 CocoaPods 将 tumblr sdk 安装到 c4 项目中。在不向 c4workspace 添加任何代码的情况下,我收到以下错误:

Ld /Users/me/Library/Developer/Xcode/DerivedData/test1-ccqtiznytmfywgdvbkcvvdlombrb/Build/Products/Debug-iphonesimulator/test1.app/test1 normal i386
    cd /Users/me/Documents/TradeCity/test1
    setenv IPHONEOS_DEPLOYMENT_TARGET 6.0
    setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.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 i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk -L/Users/me/Library/Developer/Xcode/DerivedData/test1-ccqtiznytmfywgdvbkcvvdlombrb/Build/Products/Debug-iphonesimulator -L/Users/me/Documents/TradeCity/test1/test1/Library -F/Users/me/Library/Developer/Xcode/DerivedData/test1-ccqtiznytmfywgdvbkcvvdlombrb/Build/Products/Debug-iphonesimulator -filelist /Users/me/Library/Developer/Xcode/DerivedData/test1-ccqtiznytmfywgdvbkcvvdlombrb/Build/Intermediates/test1.build/Debug-iphonesimulator/test1.build/Objects-normal/i386/test1.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -ObjC -framework Foundation -weak_framework UIKit -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=6.0 -framework Accelerate -framework AVFoundation -framework CoreFoundation -framework CoreGraphics -framework CoreImage -framework CoreMedia -framework CoreText -framework Foundation -framework OpenGLES -framework QuartzCore -framework UIKit -lC4 -lPods -o /Users/me/Library/Developer/Xcode/DerivedData/test1-ccqtiznytmfywgdvbkcvvdlombrb/Build/Products/Debug-iphonesimulator/test1.app/test1

duplicate symbol _OBJC_METACLASS_$_C4WorkSpace in:
    /Users/me/Library/Developer/Xcode/DerivedData/test1-ccqtiznytmfywgdvbkcvvdlombrb/Build/Intermediates/test1.build/Debug-iphonesimulator/test1.build/Objects-normal/i386/C4WorkSpace.o
    /Users/me/Documents/TradeCity/test1/test1/Library/libC4.a(C4WorkSpace.o)
duplicate symbol _OBJC_CLASS_$_C4WorkSpace in:
    /Users/me/Library/Developer/Xcode/DerivedData/test1-ccqtiznytmfywgdvbkcvvdlombrb/Build/Intermediates/test1.build/Debug-iphonesimulator/test1.build/Objects-normal/i386/C4WorkSpace.o
    /Users/me/Documents/TradeCity/test1/test1/Library/libC4.a(C4WorkSpace.o)
duplicate symbol _OBJC_IVAR_$_C4AppDelegate._window in:
    /Users/me/Library/Developer/Xcode/DerivedData/test1-ccqtiznytmfywgdvbkcvvdlombrb/Build/Intermediates/test1.build/Debug-iphonesimulator/test1.build/Objects-normal/i386/C4AppDelegate.o
    /Users/me/Documents/TradeCity/test1/test1/Library/libC4.a(C4AppDelegate.o)
duplicate symbol _OBJC_IVAR_$_C4AppDelegate._workspace in:
    /Users/me/Library/Developer/Xcode/DerivedData/test1-ccqtiznytmfywgdvbkcvvdlombrb/Build/Intermediates/test1.build/Debug-iphonesimulator/test1.build/Objects-normal/i386/C4AppDelegate.o
    /Users/me/Documents/TradeCity/test1/test1/Library/libC4.a(C4AppDelegate.o)
duplicate symbol _OBJC_METACLASS_$_C4AppDelegate in:
    /Users/me/Library/Developer/Xcode/DerivedData/test1-ccqtiznytmfywgdvbkcvvdlombrb/Build/Intermediates/test1.build/Debug-iphonesimulator/test1.build/Objects-normal/i386/C4AppDelegate.o
    /Users/me/Documents/TradeCity/test1/test1/Library/libC4.a(C4AppDelegate.o)
duplicate symbol _OBJC_CLASS_$_C4AppDelegate in:
    /Users/me/Library/Developer/Xcode/DerivedData/test1-ccqtiznytmfywgdvbkcvvdlombrb/Build/Intermediates/test1.build/Debug-iphonesimulator/test1.build/Objects-normal/i386/C4AppDelegate.o
    /Users/me/Documents/TradeCity/test1/test1/Library/libC4.a(C4AppDelegate.o)
ld: 6 duplicate symbols for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

架构 i386 的 6 个重复符号

我检查了另一个问题,回答的人说这与两个具有相同名称的全局变量有关(我将在几秒钟内编辑并发布链接)?

我正在使用 XCode 4.5.2 和 OSX 10.7.5

当我尝试使用 tumblrsdk 示例项目(使用 cocoapods 导入之后)时,我没有收到此错误,当我在 c4 中构建项目而不导入 tumblrsdk 时,我没有收到此错误。

4

1 回答 1

2

我在 3 个不同的场景中测试了这个问题。

首先,我使用 C4 单视图模板创建了一个新项目。我这样做了:

  • Xcode 4.6.3,旧安装程序,预编译库
  • Xcode 5,新安装程序,原始文件
  • Xcode 5,新安装程序,预编译库

在所有 3 中,我从终端执行以下操作(在我的计算机上安装 cocoapods 之后):

  1. 导航到项目的顶级目录
  2. $ 吊舱初始化
  3. 在编辑器中打开 pod 文件
  4. 取消注释并设置:平台:ios,“6.1”
  5. 添加到目标:pod 'TMTumblrSDK'
  6. 返回终端并运行: pod install
  7. 打开项目新创建的工作区
  8. 构建+运行

对于 Xcode 5 项目(包括 .lib 和原始文件),项目编译和运行时只有一些小警告(在 CocoaPods 方面,因为我对编译器设置有严格的限制)。

对于 Xcode 4.6.3 项目,我收到了与您收到的相同的警告。

不幸的是,不再支持 4.6.3 项目模板。如果您可以使用 Xcode 5 和新的安装程序,那么这对您有用。

于 2013-10-08T21:55:50.657 回答