Objective-C clang:错误:链接器命令失败,退出代码为 1

Posted

技术标签:

【中文标题】Objective-C clang:错误:链接器命令失败,退出代码为 1【英文标题】:Objective-C clang: error: linker command failed with exit code 1 【发布时间】:2015-02-03 22:07:46 【问题描述】:

当我尝试编译我的项目时遇到问题。以下是错误信息。请帮我解决这个问题。

Ld /Users/dmitriy/Library/Developer/Xcode/DerivedData/SureFireMessenger-hhpmyrmmtyjmjvajfqgednatyetg/Build/Products/Debug-iphonesimulator/SureFireMessenger.app/SureFireMessenger 正常 x86_64 cd "/Users/dmitriy/Documents/Developments/Fire Messenger/platforms/ios" 导出 IPHONEOS_DEPLOYMENT_TARGET=7.1 导出 PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin: /usr/sbin:/sbin" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8。 1.sdk -L/Users/dmitriy/Library/Developer/Xcode/DerivedData/SureFireMessenger-hhpmyrmmtyjmjvajfqgednatyetg/Build/Products/Debug-iphonesimulator -F/Users/dmitriy/Library/Developer/Xcode/DerivedData/SureFireMessenger-hhpmyrmmtyjmjvajfqgednatyetg/Build/ Products/Debug-iphonesimulator -filelist /Users/dmitriy/Library/Developer/Xcode/DerivedData/SureFireMessenger-hhpmyrmmtyjmjvajfqgednatyetg/Build/Intermediates/Sur​​eFireMessenger.build/Debug-iphonesimulator/SureFireMessenger.build/Objects-normal/x86_64/SureFireMessenger.LinkFileList - Xlinker -objc_abi_version -Xlinker 2 -weak_framework CoreFoundation -weak_framework UIKit -weak_framework AVFoundation -weak_framework CoreMedia -weak-lSystem -force_load /Users/dmitriy/Library/Developer/Xcode/DerivedData/SureFireMessenger-hh pmyrmmtyjmjvajfqgednatyetg/Build/Products/Debug-iphonesimulator/libCordova.a -ObjC -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=7.1 -framework AssetsLibrary -framework CoreGraphics -framework MobileCoreServices -framework CoreLocation -weak_framework SystemConfiguration -weak_framework ImageIO -weak_framework AudioToolbox -weak_framework AddressBook -weak_framework AddressBookUI -Xlinker -dependency_info -Xlinker /Users/dmitriy/Library/Developer/Xcode/DerivedData/SureFireMessenger-hhpmyrmmtyjmjvajfqgednatyetg/Build/Intermediates/Sur​​eFireMessenger.build/Debug-iphonesimulator /SureFireMessenger.build/Objects-normal/x86_64/SureFireMessenger_dependency_info.dat -o /Users/dmitriy/Library/Developer/Xcode/DerivedData/SureFireMessenger-hhpmyrmmtyjmjvajfqgednatyetg/Build/Products/Debug-iphonesimulator/SureFireMessenger.app/SureFireMessenger

ld:找不到文件:/Users/dmitriy/Library/Developer/Xcode/DerivedData/SureFireMessenger-hhpmyrmmtyjmjvajfqgednatyetg/Build/Products/Debug-iphonesimulator/libCordova.a clang:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)

【问题讨论】:

您是否将 Cordova 库添加到您的项目中? 【参考方案1】:

看起来像“libCordova.a”文件,缺少一个静态库文件。

你确定你所有的接线都正确吗?

【讨论】:

以上是关于Objective-C clang:错误:链接器命令失败,退出代码为 1的主要内容,如果未能解决你的问题,请参考以下文章

clang:错误:不能同时指定“-fobjc-arc”和“-fobjc-gc”

是否有仅适用于 Objective-C 的 Clang 标志?

如何用clang-format格式化objective-c块?

重载抽象运算符 = 时出现 Clang 链接器错误

Linux Clang和Objective-C基础库

clang:错误:链接器命令失败,退出代码为 1,react-native