xcode 目标 ... 覆盖 `Pods/Pods.xcconfig 中定义的 `OTHER_LDFLAGS` 构建设置
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18376416/
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
The target ... overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Pods.xcconfig
提问by huggie
I have incorporate SpatialIite
into a Xcode project which uses a header file from Proj.4
, just one header. Both are Xcode projects and have static targets.
我已经合并SpatialIite
到一个 Xcode 项目中,该项目使用来自 的头文件Proj.4
,只有一个头文件。两者都是 Xcode 项目并且具有静态目标。
I'm trying to migrate from git submodule to Cocoapods. Since static targets seems to be difficult to use with Cocoapods, I just want to have the project built in the usual way. I made podspec for Proj.4
. After writing podfile for SpatialLite
I got the warnings:
我正在尝试从 git 子模块迁移到 Cocoapods。由于静态目标似乎很难与 Cocoapods 一起使用,我只想以通常的方式构建项目。我为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.
I read this issuebut I'm pretty clueless to what the warnings mean and what can I do to fix it.
我阅读了这个问题,但我对警告的含义以及我能做些什么来解决它一无所知。
Additionally problem, when I open the workspace as well as opening SpatiaLite project alone, both are targeted to Mac OSX 64, when it is suppose to be an iOS project. My podfile does say "platform :ios".
另外的问题是,当我打开工作区以及单独打开 SpatiaLite 项目时,两者都针对 Mac OSX 64,假设它是一个 iOS 项目。我的 podfile 确实说“平台:ios”。
回答by Ankish Jain
This definitely works most of the time:
这在大多数情况下肯定有效:
Go to your target Build Settings -> Other linker flags -> double click . Add $(inherited)
to a new line.
转到您的目标构建设置 -> 其他链接器标志 -> 双击 . 添加$(inherited)
到新行。
If you have problem with "...target overrides the GCC_PREPROCESSOR_DEFINITIONS build setting defined in..." then you must add $(inherited) to your target Build Settings -> Preprocessor Macros
如果您对“...目标覆盖在...中定义的 GCC_PREPROCESSOR_DEFINITIONS 构建设置有疑问”,那么您必须将 $(inherited) 添加到您的目标构建设置 -> 预处理器宏
回答by phatmann
There is a conflict between your build settings and the default build settings that Cocoapods wants. To see the Cocoapods build settings, view the .xcconfig file(s) in Pods/Target Support Files/Pods-${PROJECTNAME}/ in your project. For me this file contains:
您的构建设置与 Cocoapods 想要的默认构建设置之间存在冲突。要查看 Cocoapods 构建设置,请查看项目中 Pods/Target Support Files/Pods-${PROJECTNAME}/ 中的 .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
If you are happy with the Cocoapods settings, then go to Build Settings for your project, find the appropriate setting and hit the Delete key. This will use the setting from Cocoapods.
如果您对 Cocoapods 设置感到满意,请转到项目的 Build Settings,找到适当的设置并按 Delete 键。这将使用 Cocoapods 的设置。
On the other hand, if you have a custom setting that you need to use, then add $(inherited) to that setting.
另一方面,如果您有需要使用的自定义设置,则将 $(inherited) 添加到该设置中。
回答by zeeawan
I've seen these 3 errors for pod command in terminal
我在终端中看到了 pod 命令的这 3 个错误
pod install
[!] The MY_APP [Debug/Release] target overrides the HEADER_SEARCH_PATHS ...
[!] The MY_APP [Debug/Release] target overrides the OTHER_LDFLAGS ...
[!] The MY_APP [Debug/Release] target overrides the GCC_PREPROCESSOR_DEFINITIONS ...
[!] MY_APP [Debug/Release] 目标覆盖 HEADER_SEARCH_PATHS ...
[!] MY_APP [Debug/Release] 目标覆盖 OTHER_LDFLAGS ...
[!] MY_APP [Debug/Release] 目标覆盖 GCC_PREPROCESSOR_DEFINITIONS .. .
All these 3 errors would be gone by adding $(inherited)to
通过将$(inherited)添加到,所有这 3 个错误都将消失
- Header Search Paths
- Other Linker Flags
- Preprocessor Macros
- 标题搜索路径
- 其他链接器标志
- 预处理器宏
in Project -> Target -> Build Settings
在项目 -> 目标 -> 构建设置中
And now the command would run without giving any errors
现在该命令将运行而不会出现任何错误
pod install
回答by SamirChen
In your project, find Target -> Build Settings -> Other Linker Flags
, select Other Linker Flags
, press delete
(Mac Keyboard)/Backspace
(Normal keyboard) to recover the setting. It works for me.
在您的项目中,找到Target -> Build Settings -> Other Linker Flags
,选择Other Linker Flags
,按delete
(Mac 键盘)/ Backspace
(普通键盘)恢复设置。这个对我有用。
Example:
例子:
Before
前
After
后
回答by Anil
Just had a similar issue when I ran pod install
, I saw the following warnings/errors (related to CLANG_CXX_LIBRARY
):
刚运行时遇到类似问题pod install
,我看到以下警告/错误(与 相关CLANG_CXX_LIBRARY
):
The Error/Warning from Cocoapods
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.
The Fix
修复
- Select your
Project
so you can see theBuild Settings
. - Select your
Target
(AppName
underTargets
) - Find
C++ Standard Library
(It will probably be in BOLD- This means it's overridden). - Select the Line (So it's highlighted Blue), and press ? + DELETE(Command + Backspace)
- 选择您的,
Project
以便您可以看到Build Settings
. - 选择您的
Target
(AppName
下Targets
) - 查找
C++ Standard Library
(它可能会以粗体显示- 这意味着它已被覆盖)。 - 选择该行(因此突出显示为蓝色),然后按? + DELETE(Command + Backspace)
The line should not be bolded anymore and if you run pod install
the warnings/errors should have disappeared.
该行不应再加粗,如果您运行pod install
警告/错误应该已经消失。
Visual Aid
视觉辅助
回答by Amit Saxena
If Xcode complains when linking, e.g. Library not found for -lPods, it doesn't detect the implicit dependencies:
如果 Xcode 在链接时抱怨,例如未找到 -lPods 的库,它不会检测隐式依赖项:
Go to Product > Edit Scheme Click on Build Add the Pods static library Clean and build again
转到 Product > Edit Scheme 单击 Build 添加 Pods 静态库 Clean 并再次构建
回答by Andreas Olsson
回答by sanjana
I added $(inherited) but my project was still not compiling. For me problem was flag "Build for active Architecture only", I had to set it to YES.
我添加了 $(inherited) 但我的项目仍然没有编译。对我来说,问题是标记“仅针对活动架构构建”,我必须将其设置为 YES。
回答by Nikolay Shubenkov
The first line of link below saved my day:
下面的第一行链接拯救了我的一天:
To add values to options from your project's build settings, prepend the value list with $(inherited).
要将值添加到项目构建设置中的选项,请在值列表前加上 $(inherited)。
https://github.com/CocoaPods/CocoaPods/wiki/Creating-a-project-that-uses-CocoaPods#faq
https://github.com/CocoaPods/CocoaPods/wiki/Creating-a-project-that-uses-CocoaPods#faq
Also, do not forget to insert this line at the beginning of your pod file:
另外,不要忘记在 pod 文件的开头插入这一行:
platform :iOS, '5.0'