静态库路径噩梦从地狱 [英] Static Library path nightmare from hell
问题描述
这是点。我有一个子项目(静态库)创建。库编译良好。没有错误。当我在项目中包含这个库并从该库中导入项目的标题时,库无法编译,因为它找不到属于自己的路径。
在web上有一些关于如何创建一个静态库并嵌入到项目中的教程,我不知道哪一个是正确的,因为我已经尝试了所有的失败,有些不同。
这是库的设置方式:
静态库
建立设置:
- 公共头文件夹path =
$(BUILT_PRODUCTS_DIR)
- 头搜索路径=
$(SRCROOT) code> (递归)
BUILD PHASES >
COPY FILES = 1文件,myLibrary.h基本上是空的(由我使用静态库模板启动库时由xcode创建)。
没有添加复制头阶段
MAIN PROJECT
建立设置
- search path = empty
- 用户标题搜索路径=
$(BUILT_PRODUCTS_DIR)
>
- 始终搜索用户路径=
是
< BUILD PHASES
- 是,
myLibrary.a
对目标依赖项
令我惊讶的是,库编译好,无法找到属于自己的库的头。
注意:我也试图在库上创建一个复制头阶段public all <$ c $
这是一个错误的示例:
$ b $ /Users/mike/Library/Developer/Xcode/DerivedData/MyApp-dnaimaovscreasadhmvgttwjnabc/Build/Products/Debug-iphoneos/include/myLibrary/ccTypes.h: 39:9:
致命错误:找不到平台/ CCGL.h文件
#importPlatforms / CCGL.h
我失去了两天试图解决这个噩梦。
任何想法?
经过近5天的噩梦试图解决这个问题,我终于找到了这篇教程: http:/ /www.youtube.com/watch?v=XUhLETxgcoE
这是唯一适用于我的解决方案。最简单和最好的。
感谢每一个试图解决这个问题的人。
This is the point. I have a subproject (static library) created. The library compiles well. No errors. When I include this library inside a project and imports a header from that library on the project the library fails to compile because it cannot find a path that belongs to itself.
After following a bunch of tutorials on the web on how to create a static library and embed that in a project, I don't know which one is the correct one, because I have tried all and all failed and some differ.
This is how the library is set:
STATIC LIBRARY
BUILD SETTINGS:
- Public header folder path =
$(BUILT_PRODUCTS_DIR)
- Header search path =
$(SRCROOT)
(recursive)
BUILD PHASES
COPY FILES = 1 file, myLibrary.h that is basically empty (created by xcode when I used the static library template to start the library.
no ADD COPY HEADERS phase
MAIN PROJECT
BUILD SETTINGS
- Header search path = empty
- User header search path =
$(BUILT_PRODUCTS_DIR)
(recursive) - Always search user paths =
YES
BUILD PHASES
- Yes,
myLibrary.a
is on target dependencies
What amazes me is that the library compiles fine alone but when put inside a project, is unable to find a header that belongs to the own library.
NOTE: I have also tried to create a copy headers phase on the library making public all .h
on that library, but it failed too.
This is an example of one error:
/Users/mike/Library/Developer/Xcode/DerivedData/MyApp-dnaimaovscreasadhmvgttwjnabc/Build/Products/Debug-iphoneos/include/myLibrary/ccTypes.h:39:9:
fatal error: 'Platforms/CCGL.h' file not found
#import "Platforms/CCGL.h"
I have lost two days trying to solve this nightmare.
any thoughts?
I have uploaded a sample project to here and here
After almost 5 days of a nightmare trying to solve that, I finally found this tutorial: http://www.youtube.com/watch?v=XUhLETxgcoE
This is the only solution that worked for me. The simplest and the best.
Thanks for every one trying to solve this.
这篇关于静态库路径噩梦从地狱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!