iphone - 在编译应用程序时遇到这样的错误

这是错误日志,我得到了

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

最佳答案

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

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

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

https://stackoverflow.com/questions/10779956/

相关文章:

android - Maven不会因引入的编译错误而失败

ant - 如何在不使用 IDE(Netbeans 等)的情况下使用外部库编译 java 文件?

xcode - 项目清理后,Cocos2d/box2d项目将无法编译

ruby-on-rails - SCSS编译错误

visual-studio-2010 - MS VS 2010 srand()无法编译?

android - 使用PendingIntent的编译错误

ruby-on-rails - 使用Mysql在共享服务器中部署Rails应用程序时出错

visual-c++ - 升级项目:operator '=' is ambiguous and 'i

scala - 为什么在 Scala 中压缩比 zip 快?

compilation - 在我的编译器中完全可以正常工作,但在将其提交到在线社区时会出现编译错误