XCode 链接器错误:未找到 -lAdMobDevice 的库
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1471968/
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
XCode linker error : library not found for -lAdMobDevice
提问by Jugs
I am trying to build lite version of my iPhone application using AdMob. I followed the guidelines here http://www.iphonedevsdk.com/forum/iphone-sdk-development/11358-creating-lite-version-app.htmland created two different targets. In the lite version I added a macro called LITEVERSION which I am checking using #ifdef and doing the appropriate things.
我正在尝试使用 AdMob 构建我的 iPhone 应用程序的精简版。我遵循http://www.iphonedevsdk.com/forum/iphone-sdk-development/11358-creating-lite-version-app.html的指南并创建了两个不同的目标。在精简版中,我添加了一个名为 LITEVERSION 的宏,我正在使用 #ifdef 进行检查并执行适当的操作。
But when I build the lite version of the app, I get a linker error
但是当我构建应用程序的精简版时,出现链接器错误
ld: library not found for -lAdMobDevice collect2: ld returned 1 exit status
ld:找不到 -lAdMobDevice collect2 的库:ld 返回 1 个退出状态
However I am able to build the full version without any issues and also noticed that build is working fine (for the fullversion) even if I remove the #ifdef macros. This suggests that the libAdMobSimulator.a library is linking properly for the full version however it fails on the lite version.
但是,我能够在没有任何问题的情况下构建完整版本,并且还注意到即使我删除了 #ifdef 宏,构建也可以正常工作(对于完整版本)。这表明 libAdMobSimulator.a 库可以正确链接完整版,但在 lite 版本上却失败了。
Any pointers would be greatly appreciated!
任何指针将不胜感激!
Cheers Jugs
干杯罐
回答by Kris Jenkins
When I had this problem, the cause was that I'd added the library into Xcode by dragging it in like a regular source file.
当我遇到这个问题时,原因是我将库添加到 Xcode 中,就像将它拖入常规源文件一样。
The fix was to remove it, and then add it properly using the "Add->Existing Frameworks..." dialogue.
修复方法是删除它,然后使用“添加->现有框架...”对话框正确添加它。
回答by zeeawan
I got similar error as I was using CocoaPods libraries
我在使用 CocoaPods 库时遇到了类似的错误
library not found for -lPods-MyApp
找不到 -lPods-MyApp 的库
I got the error because I opened xcode project instead of workspace.
我收到错误是因为我打开了 xcode project 而不是workspace。
回答by westonplatter
回答by Roxana
I had the same problem with Google Analytics library. My problem was that I forgot to add the path to the Library Search Paths in my target's build settings. (Target -> Build Settings -> Library Search Paths)
我在使用 Google Analytics 库时遇到了同样的问题。我的问题是我忘记在目标的构建设置中添加库搜索路径的路径。(目标 -> 构建设置 -> 库搜索路径)
回答by Jugs
I figured out what he problem was. I just removed all frameworks and libraries and added them back in for both the targets and it worked!
我弄清楚他的问题是什么。我刚刚删除了所有框架和库,并将它们重新添加到两个目标中,并且它起作用了!
Cheers
干杯
回答by kenshin
I cause this because of a libray libMobClickLibrary.a which is used in youmeng sdk missed. I fix the issued after copy libMobClickLibrary.a to the project floder.
我之所以出现这种情况,是因为漏掉了在 Youmeng sdk 中使用的库 libMobClickLibrary.a。我修复了将 libMobClickLibrary.a 复制到项目 floder 后发出的问题。