ios Apple Mach-O 链接器 (id) 错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7107087/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 21:10:29  来源:igfitidea点击:

Apple Mach-O Linker (id) Error

iosxcode4

提问by Joshua Son

I have an error below:

我有以下错误:

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

Could someone help me out? It used to work properly before. I have no idea what I have changed in the project sources. But I am sure that I never changed anything in that FMDatabase.h and .m.

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

采纳答案by lemnar

The relevant portion of your error is ld: duplicate symbol _OBJC_IVAR_$_FMDatabase.databasePath. For some reason, the linker (ld) is trying to link FMDatabasetwice. Check to see if you have multiple copies of it in your project.

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

回答by toujamaru

I once got this error when I was initializing values to constants defined in the global scope in my .h file.

当我将值初始化为 .h 文件中全局作用域中定义的常量时,我​​曾经遇到过这个错误。

Solved the problem, by declaring them in the header, and initializing them in the .m file.

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

回答by dakami

This is a quite old post, but maybe it still helps somebody.

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

Just had the same problem, for me the solution was: I accidently linked an .m file in one of the headers instead of the .h file. Just changed that to properly link the .h file.

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

回答by Yanis

Check if you import framework which required.

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

回答by Jerome

I solve the problem by updating my framework.

我通过更新我的框架解决了这个问题。

回答by George Filippakos

I solved by performing a Clean .

我通过执行 Clean 解决了。

Then could Build.

然后可以构建。