【问题标题】:Apple Mach-O Linker (id) ErrorApple Mach-O 链接器 (id) 错误
【发布时间】:2011-08-18 12:01:28
【问题描述】:

我在下面有一个错误:

ld /Volumes/Data/Library/Developer/Xcode/DerivedData/uniText-cgynaitlevdrajfeoaldwldehaft/Build/Products/Debug-iphonesimulator/uniText.app/uniText normal i386
    cd "/Volumes/Data/Documents/XCode Projects/Trans SMS"
    setenv MACOSX_DEPLOYMENT_TARGET 10.6
    setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk -L/Volumes/Data/Library/Developer/Xcode/DerivedData/uniText-cgynaitlevdrajfeoaldwldehaft/Build/Products/Debug-iphonesimulator -F/Volumes/Data/Library/Developer/Xcode/DerivedData/uniText-cgynaitlevdrajfeoaldwldehaft/Build/Products/Debug-iphonesimulator -filelist /Volumes/Data/Library/Developer/Xcode/DerivedData/uniText-cgynaitlevdrajfeoaldwldehaft/Build/Intermediates/uniText.build/Debug-iphonesimulator/uniText.build/Objects-normal/i386/uniText.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -framework SystemConfiguration -framework MessageUI -framework AddressBook -framework AddressBookUI -framework CoreTelephony -lsqlite3.0 -framework UIKit -framework Foundation -framework CoreGraphics -o /Volumes/Data/Library/Developer/Xcode/DerivedData/uniText-cgynaitlevdrajfeoaldwldehaft/Build/Products/Debug-iphonesimulator/uniText.app/uniText

ld: duplicate symbol _OBJC_IVAR_$_FMDatabase.databasePath in /Volumes/Data/Library/Developer/Xcode/DerivedData/uniText-cgynaitlevdrajfeoaldwldehaft/Build/Intermediates/uniText.build/Debug-iphonesimulator/uniText.build/Objects-normal/i386/FMDatabase-566DC6D59187887D.o and /Volumes/Data/Library/Developer/Xcode/DerivedData/uniText-cgynaitlevdrajfeoaldwldehaft/Build/Intermediates/uniText.build/Debug-iphonesimulator/uniText.build/Objects-normal/i386/FMDatabase-566DC6D59187887D.o for architecture i386
collect2: ld returned 1 exit status
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 failed with exit code 1

有人可以帮我吗? 它以前可以正常工作。 我不知道我在项目来源中发生了什么变化。 但我确信我从未更改过 FMDatabase.h 和 .m 中的任何内容。

【问题讨论】:

    标签: ios xcode4


    【解决方案1】:

    您的错误的相关部分是ld: duplicate symbol _OBJC_IVAR_$_FMDatabase.databasePath。出于某种原因,链接器 (ld) 试图链接 FMDatabase 两次。检查您的项目中是否有多个副本。

    【讨论】:

    • 我觉得你的回答很有道理。但如果我检查项目,我只有一份 .h 和 .m 文件的副本。分别是 FMDatabase.h 和 FMDatabase.m。我应该再次寻找什么?
    • 这也帮助我解决了问题 - 谢谢。只是对一个文件有双重引用。
    • 双重引用是什么意思?帮助!!!如何检查我是否对文件有双重引用???
    【解决方案2】:

    我曾经在我的 .h 文件中将值初始化为全局范围内定义的常量时遇到此错误。

    通过在标头中声明它们并在 .m 文件中初始化它们来解决问题。

    【讨论】:

    • 又一个使用宏的理由!
    【解决方案3】:

    这是一篇很老的帖子,但也许它仍然对某人有所帮助。

    刚刚遇到了同样的问题,对我来说,解决方案是:我不小心将一个 .m 文件链接到一个标题中,而不是 .h 文件。只是将其更改为正确链接 .h 文件。

    【讨论】:

      【解决方案4】:

      检查你是否导入了需要的框架。

      【讨论】:

        【解决方案5】:

        我通过更新我的框架来解决问题。

        【讨论】:

          【解决方案6】:

          我通过执行 Clean 解决了。

          然后可以构建。

          【讨论】:

            猜你喜欢
            • 2011-10-09
            • 1970-01-01
            • 1970-01-01
            • 2012-02-26
            • 2011-12-06
            • 1970-01-01
            • 2014-04-06
            相关资源
            最近更新 更多