0

这是我得到的错误日志

Ld /Users/apple/Library/Developer/Xcode/DerivedData/SMTPExample-dkhosyetbsajvtcdyyalnckswjgd/Build/Products/Debug-iphonesimulator/SMTPExample.app/SMTPExample normal i386
    cd /Users/apple/Desktop/SMTPExample
    setenv MACOSX_DEPLOYMENT_TARGET 10.6
    setenv PATH "/xcode4/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/xcode4/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /xcode4/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 -arch i386 -isysroot /xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk -L/Users/apple/Library/Developer/Xcode/DerivedData/SMTPExample-dkhosyetbsajvtcdyyalnckswjgd/Build/Products/Debug-iphonesimulator -F/Users/apple/Library/Developer/Xcode/DerivedData/SMTPExample-dkhosyetbsajvtcdyyalnckswjgd/Build/Products/Debug-iphonesimulator -F/Users/apple/Desktop/SMTPExample -filelist /Users/apple/Library/Developer/Xcode/DerivedData/SMTPExample-dkhosyetbsajvtcdyyalnckswjgd/Build/Intermediates/SMTPExample.build/Debug-iphonesimulator/SMTPExample.build/Objects-normal/i386/SMTPExample.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -framework Security -framework CFNetwork -framework UIKit -framework Foundation -framework CoreGraphics -framework DropboxSDK -o /Users/apple/Library/Developer/Xcode/DerivedData/SMTPExample-dkhosyetbsajvtcdyyalnckswjgd/Build/Products/Debug-iphonesimulator/SMTPExample.app/SMTPExample

ld: duplicate symbol _EstimateBas64EncodedDataSize in /Users/apple/Desktop/SMTPExample/DropboxSDK.framework/DropboxSDK and /Users/apple/Library/Developer/Xcode/DerivedData/SMTPExample-dkhosyetbsajvtcdyyalnckswjgd/Build/Intermediates/SMTPExample.build/Debug-iphonesimulator/SMTPExample.build/Objects-normal/i386/Base64Transcoder.o for architecture i386
collect2: ld returned 1 exit status
Command /xcode4/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 failed with exit code 1
4

1 回答 1

1

这是一个链接器错误(输出中的“ld”表示这一点,因为输出错误是由GNU 链接器程序生成的)。

发生的事情是两个相同的声明已从两个单独的源代码文件中分别编译。这些源文件之一可能被命名为Base64Transcoder.mBase64Transcoder.cpp(因为导致问题的编译文件是Base64Transcoder.o)。有问题的声明是_EstimateBas64EncodingDataSize. 这个符号在不同的源代码文件中被多次声明,然后链接器抛出错误,因为两个编译的源代码文件不同。您需要查看正在编译的整个源代码并解决冲突。

希望这有帮助并且有意义,我一直发现链接器问题难以理解和处理。我真的强烈建议阅读 C/C++/Objective-C 代码的程序编译的链接器阶段(是一个非常好的指南)。然后你应该能够更好地理解引擎盖下发生了什么!:)

于 2012-05-28T06:07:11.303 回答