简体   繁体   English

Xcode编译器错误:ld:-lPods找不到库

[英]Xcode Compiler Error: ld: library not found for -lPods

I'm trying to use the pod library to the project "BC LitterBox", after install pod according to http://cocoapods.org/ and Complier LitterBox, I'm now down to 1 compilation error, which I can't seem to get rid of. 我正在尝试将Pod库用于项目“ BC LitterBox”,根据http://cocoapods.org/和Complier LitterBox安装pod之后,我现在只有1个编译错误,我似乎看不到摆脱。

ld: library not found for -lPods clang: error: linker command failed with exit code 1 (use -v to see invocation) ld:找不到-lPods clang的库:错误:链接器命令失败,退出代码为1(使用-v查看调用)

Anyone know what could be causing this? 有人知道是什么原因造成的吗?

When you install a pod, CocoaPods creates a new workspace that includes your project and whatever pod(s) you installed. 当您安装Pod时,CocoaPods将创建一个新的工作区,其中包括您的项目以及所安装的任何Pod。

You'll have to close your project and open that workspace. 您必须关闭项目并打开该工作区。

确保您打开的是.xcworkspace文件,而不是.xcodeproj文件

You can perform this steps: 您可以执行以下步骤:

  • Close .xcworkspace and .xcproject (Xcode Projects); 关闭.xcworkspace.xcproject (Xcode项目);
  • Run pod install and pod update ; 运行pod installpod update ;
  • Open the new .xcworkspace ; 打开新的.xcworkspace ;
  • Clean and Build your Project; CleanBuild您的项目;
  • Now, you are able to run normally. 现在,您可以正常run

When I try compile my project which used CocoaPods I have following linking error: 当我尝试编译使用CocoaPods的项目时,出现以下链接错误:

ld: library not found for -lPods  
clang: error: linker command failed with exit code 1 (use -v to see invocation)

The reason of this problem is version of CocoaPods. 此问题的原因是CocoaPods的版本。 Project was cloned from repo, then pods was installed. 从回购中克隆了项目,然后安装了pod。 But my version of cocoapods is 1.0.1. 但是我的cocoapods版本是1.0.1。 Version of cocoapods which declared in Podfile.lock is 0.39.0. 在Podfile.lock中声明的cocoapods版本为0.39.0。

Solution is following(In terminal): 解决方法如下(在终端中):
1) Uninstall CocoaPods. 1)卸载CocoaPods。
sudo gem uninstall cocoapods

2) Install version of cocoapods which declared in the Podfile.lock 2)安装在Podfile.lock中声明的cocoapods版本
sudo gem install cocoapods -v 0.39.0

3) You can check version cocoapods: 3)您可以检查版本cocoapods:
gem which cocoapods

4) Clone project then install dependencies 4)克隆项目然后安装依赖项
pod install

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM