Xcode -dynamic 未指定静态库错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22320911/
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 -dynamic not specified static library error
提问by Sammio2
I have a sub project within Xcode which creates a static library referenced by the parent project. All has been well until the release of iOS 7.1 and Xcode 5.1, suddenly I'm getting the following warning.
我在 Xcode 中有一个子项目,它创建了一个由父项目引用的静态库。在 iOS 7.1 和 Xcode 5.1 发布之前,一切都很好,突然我收到以下警告。
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: -dynamic not specified the following flags are invalid: -ObjC
warning: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/usr/lib/libsqlite3.0.dylib is a dynamic library, not added to the static library
Does anybody know what I need to do to fix this warning?
有人知道我需要做什么来解决这个警告吗?
采纳答案by M. Porooshani
I think the solutions lies in the basic concept of dynamic and static libraries. as far as libraries go, dynamic libraries (libsqlite3.0.dylib in your case) are system libraries and you do not need to add them to your static library! all you need to do is to add their reference in your final Targetyou want to use them in (your application).
我认为解决方案在于动态和静态库的基本概念。就库而言,动态库(在您的情况下为 libsqlite3.0.dylib)是系统库,您无需将它们添加到静态库中!您需要做的就是在您想要在(您的应用程序)中使用它们的最终目标中添加它们的引用。
so, in short: Try removing the reference to sqlite3.0.dylib
from your static library (I'm guessing another project you are using inside your top level application) and add it to your application (not static library) and you're probably good to go. (solved my problem)
所以,简而言之:尝试sqlite3.0.dylib
从您的静态库中删除对的引用(我猜您在顶级应用程序中使用了另一个项目)并将其添加到您的应用程序(不是静态库)中,您可能会很高兴。(解决了我的问题)
[Edit]: please commit your project's git or do whatever you do to make a backup from your project, there is a chance that Xcode may break your project with no reason after removing these dynamic libraries and NO, deleting project's Derived datawon't solve the problem.
[编辑]:请提交你的项目的 git 或做任何你做的事情来从你的项目中备份,在删除这些动态库后,Xcode 有可能无缘无故地破坏你的项目,不,删除项目的派生数据不会解决这个问题。