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

标签 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

最佳答案

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

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

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

关于iphone - 在编译应用程序时遇到这样的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10779956/

相关文章:

iphone - 使用 [UIColor colorWithRed :green:blue:alpha:] doesn't work with UITableView seperatorColor?

iphone - 为什么我的 EAGLVIew 在 iOS 4.2 中不再渲染?

iphone - 在 iPhone 中查找特定服务器

c++ - 加法产生的 C++ 类型是什么

c++ - 抽象类/函数编译错误

ios - 为什么将 UITableViewCell 连接到 UInavigationcontroller 时没有任何反应

iphone - 检测点击以显示/隐藏 UINavigationBar

java - 编译opencv时出现"cannot find symbol"

iphone - 从 plist 数组加载 MapView 注释时出现问题 - Xcode 4.2

iphone - Storyboard中设置的 rootViewController 未在应用程序启动时显示