Xcode:在框架中使用静态库?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/35071950/
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: use a static library in a framework?
提问by dcow
I have a framework that links against two static libraries. Each static library is a target and the framework is a target. The framework wraps the static libraries and clients of the framework only care about calling framework code (which in turn may call code from each static library). Is is possible to have the framework include the required headers and object files? When I build I get the infamous Include of non-module header inside framework module
error. Each static library exports its headers and I've added the headers as public headers in the framework. Still no luck (and I would think there's a solution that doesn't require this).
我有一个链接两个静态库的框架。每个静态库都是一个目标,框架是一个目标。框架封装了静态库,框架的客户端只关心调用框架代码(反过来可能调用每个静态库的代码)。是否可以让框架包含所需的头文件和目标文件?当我构建时,我得到了臭名昭著的Include of non-module header inside framework module
错误。每个静态库都导出其标头,我已将标头添加为框架中的公共标头。仍然没有运气(我认为有一个不需要这个的解决方案)。
回答by dcow
Each static library must export a module.modulemap
file with its headers. Contrary to popular wisdom, once this is complete, you need notadd a bunch of headers to the Publicsection of the framework's Headersbuild phasein order to alleviate the error. The process is described in detail here: http://blog.bjhomer.com/2015/05/defining-modules-for-custom-libraries.html
每个静态库都必须导出一个module.modulemap
文件及其标头。与流行的智慧,一旦完成,你需要不一系列的头添加到公共框架的部分头构建阶段,以缓解该错误。这里详细描述了这个过程:http: //blog.bjhomer.com/2015/05/defining-modules-for-custom-libraries.html