• library not found for -lPods 的解决办法


    在老项目工程中使用cocoapods,可能会报这个错误:library not found for -lPods .

    导致这个错误可能有两个原因,这两个原因在编译过程中都是有蛛丝马迹可循的。

    原因1:

    在 pod install时,就会有告警信息提示:

    xxx target overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Target Support Files/Pods/Pods.debug.xcconfig'. This can lead to problems with the CocoaPods installation

    xxx target overrides the `HEADER_SEARCH_PATHS` build setting defined in `Pods/Target Support Files/Pods/Pods.release.xcconfig'. This can lead to problems with the CocoaPods installation

    xxx target overrides the `OTHER_CFLAGS` build setting defined in `Pods/Target Support Files/Pods/Pods.release.xcconfig'. This can lead to problems with the CocoaPods installation

    This can lead to problems with the CocoaPods installation
        - Use the `$(inherited)` flag, or
        - Remove the build settings from the target.
        - Use the `$(inherited)` flag, or
        - Remove the build settings from the target.
        - Use the `$(inherited)` flag, or
        - Remove the build settings from the target.
        - Use the `$(inherited)` flag, or
        - Remove the build settings from the target.
        - Use the `$(inherited)` flag, or
        - Remove the build settings from the target.
        - Use the `$(inherited)` flag, or
        - Remove the build settings from the target.

    很明确的告知:通过添加 `$(inherited)` flag 可以解决该问题。

    根据调试确认,OTHER_LDFLAGS 指的是 other linker flags; OTHER_CFLAGS 指的是 other c flags;HEADER_SEARCH_PATHS 指的是 header search paths.

    将这三处修改完毕后再次运行pod install,可以发现告警信息已经不再出现了。


    原因2:

    在编译时有如下的警告和错误:

    1.警告: Target 'Pods' of project 'Pods' was rejected as an implicit dependency for 'libPods.a' because its architectures 'arm64' didn't contain all required architectures 'armv7 arm64'

    2.错误: ld: library not found for -lpop
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

    这里不留神可能警告会被忽略(毕竟在一个老项目中有一些警告很正常),但这个警告才是问题的关键。

    pod里面的build选项里build active architecture only 在 debug情形下默认是 YES, 这里如果和你项目的该设置不匹配(笔者用来调试的项目这里设置就是NO)的话那么就会报告该错误。

    在pods里面的target中挨个修改其配置和原有的工程一致,然后clean编译,项目即可正常运行。

  • 相关阅读:
    BCB编写DLL终极手册
    C++Builder常用函数
    c++与js脚本交互,C++调用JS函数JS调用C++函数
    JS调用C++
    c&c++MFC 调用 js 函数代码
    C++调用JS,JS调用C++
    MFC基础类及其层次结构
    MFC文档视图结构学习笔记
    深入理解JVM虚拟机1:JVM内存的结构与永久代的消失
    深入理解JVM虚拟机开篇:JVM介绍与知识脉络梳理
  • 原文地址:https://www.cnblogs.com/fengju/p/6173618.html
Copyright © 2020-2023  润新知