静态库路径噩梦从地狱 [英] Static Library path nightmare from hell

查看:73
本文介绍了静态库路径噩梦从地狱的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是点。我有一个子项目(静态库)创建。库编译良好。没有错误。当我在项目中包含这个库并从该库中导入项目的标题时,库无法编译,因为它找不到属于自己的路径。



在web上有一些关于如何创建一个静态库并嵌入到项目中的教程,我不知道哪一个是正确的,因为我已经尝试了所有的失败,有些不同。



这是库的设置方式:






静态库



建立设置


  1. 公共头文件夹path = $(BUILT_PRODUCTS_DIR)

  2. 头搜索路径= $(SRCROOT) code> (递归)

BUILD PHASES >

COPY FILES = 1文件,myLibrary.h基本上是空的(由我使用静态库模板启动库时由xcode创建)。



没有添加复制头阶段






MAIN PROJECT



建立设置


  1. search path = empty

  2. 用户标题搜索路径= $(BUILT_PRODUCTS_DIR) >
  3. 始终搜索用户路径=



< BUILD PHASES




  1. 是, 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:

  1. Public header folder path = $(BUILT_PRODUCTS_DIR)
  2. 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

  1. Header search path = empty
  2. User header search path = $(BUILT_PRODUCTS_DIR) (recursive)
  3. Always search user paths = YES

BUILD PHASES

  1. 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆