虽然编译应用程序正在收到这样的错误

时间:2012-05-28 05:58:49

标签: iphone compiler-errors xcode4.2

这是错误日志,我得到了

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

1 个答案:

答案 0 :(得分:1)

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

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

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