目标…覆盖`Pods / Pods.xcconfig中定义的`OTHER_LDFLAGS`构build设置

我已经将SpatialIite合并到使用Proj.4的头文件的Xcode项目中,只有一个头文件。 两者都是Xcode项目,并有静态目标。

我试图从git submodule迁移到Cocoapods。 由于静态目标似乎很难与Cocoapods一起使用,所以我只想以通常的方式构build项目。 我为Proj.4制作了Proj.4 。 在为SpatialLite编写podfile后,我得到了警告:

 [!] The target `SpatialiteIOS [Debug]` overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Pods.xcconfig'. - Use the `$(inherited)` flag, or - Remove the build settings from the target. [!] The target `SpatialiteIOS [Debug]` overrides the `HEADER_SEARCH_PATHS` build setting defined in `Pods/Pods.xcconfig'. - Use the `$(inherited)` flag, or - Remove the build settings from the target. [!] The target `SpatialiteIOS [Debug - Release]` overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Pods.xcconfig'. - Use the `$(inherited)` flag, or - Remove the build settings from the target. [!] The target `SpatialiteIOS [Debug - Release]` overrides the `HEADER_SEARCH_PATHS` build setting defined in `Pods/Pods.xcconfig'. - Use the `$(inherited)` flag, or - Remove the build settings from the target. 

我读过这个问题,但是我对这些警告意味着什么,以及我能做些什么来解决它。

另外还有一个问题,当我打开工作区以及单独打开SpatiaLite项目时,两者都是针对Mac OSX 64的,当它假设为一个iOS项目时。 我的podfile确实说“platform:ios”。

这在绝大多数情况下都有效:

转到您的目标生成设置 – >其他链接器标志 – >双击。 将$(inherited)添加到新行。

如果您遇到“… target覆盖在…中定义的GCC_PREPROCESSOR_DEFINITIONS构build设置”的问题,那么您必须将$(inheritance)添加到您的目标构build设置 – >预处理器macros

您的构build设置与Cocoapods需要的默认构build设置之间存在冲突。 要查看Cocoapods构build设置,请在项目的Pods / Pods.xcconfig中查看该文件。 对我来说这个文件包含:

 GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers" "${PODS_ROOT}/Headers/Commando" OTHER_LDFLAGS = -ObjC -framework Foundation -framework QuartzCore -framework UIKit PODS_ROOT = ${SRCROOT}/Pods 

如果您对Cocoapods设置感到满意,那么请转到您的项目的“生成设置”,find相应的设置并点击Delete键。 这将使用来自Cocoapods的设置。

另一方面,如果您有需要使用的自定义设置,请将$(inheritance)添加到该设置。

我在terminal看到了这三个pod命令的错误

 pod install 

[!] MY_APP [Debug / Release]目标覆盖HEADER_SEARCH_PATHS …
[!] MY_APP [Debug / Release]目标覆盖OTHER_LDFLAGS …
[!] MY_APP [Debug / Release]目标覆盖GCC_PREPROCESSOR_DEFINITIONS …

所有这3个错误将通过添加$(inheritance)来消失

  1. 标题searchpath
  2. 其他链接器标志
  3. 预处理器macros

项目 – >目标 – >生成设置

而现在这个命令会运行而不会出现任何错误

 pod install 

在你的项目中,findTarget -> Build Settings -> Other Linker Flags ,selectOther Linker Flags ,按delete (Mac键盘)/ Backspace (普通键盘)恢复设置。 这个对我有用。

例:

之前 在这里输入图像说明

在这里输入图像说明

刚运行pod install时遇到类似的问题,我看到以下警告/错误(与CLANG_CXX_LIBRARY相关):

来自Cocoapods的错误/警告

 [!] The `Project [Debug]` target overrides the `CLANG_CXX_LIBRARY` build setting defined in `Pods/Target Support Files/Pods/Pods.debug.xcconfig'. This can lead to problems with the CocoaPods installation - Use the `$(inherited)` flag, or - Remove the build settings from the target. [!] The `Project [Release]` target overrides the `CLANG_CXX_LIBRARY` build setting defined in `Pods/Target Support Files/Pods/Pods.release.xcconfig'. This can lead to problems with the CocoaPods installation - Use the `$(inherited)` flag, or - Remove the build settings from the target. 

修正

  1. select您的Project以便您可以看到Build Settings
  2. select您的TargetTargets下的AppName
  3. findC++ Standard Library (它可能会在大胆 – 这意味着它被覆盖)。
  4. select行(所以它突出显示为蓝色),然后按⌘+ DELETE (Command + Backspace)

该行不应该加粗,如果你运行pod install ,警告/错误应该已经消失。


视觉辅助

CLANG_CXX_LIBRARY错误/警告与Cocoapods

如果Xcode在链接时发生抱怨,比如找不到-lPods的库,它不会检测到隐式依赖关系:

转到产品>编辑scheme单击生成添加豆豆静态库清理并再次生成

下面的链接第一行救了我的一天:

要将值添加到项目的构build设置中的选项,请在$(inheritance)前添加值列表。

https://github.com/CocoaPods/CocoaPods/wiki/Creating-a-project-that-uses-CocoaPods#faq

另外,不要忘记在你的pod文件的开头插入这行:

 platform :iOS, '5.0' 

我加$(inheritance),但我的项目仍然没有编译。 对我来说问题是“只为活动架构构build”,我不得不将它设置为YES。

对我来说,问题是我的目标testing。 我已经在我的主要应用程序目标中有$(inherited)标志。

我将它添加到MyAppTests其他链接器标志。 之后,当我运行pod install ,警告消息消失了。 在这里输入图像说明