ios 为什么 Xcode 找不到这个头文件?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5634071/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 19:33:26  来源:igfitidea点击:

why can't Xcode find this header file?

iphoneiosxcode4three20

提问by Greg

Hi I'm getting an xcode "no such file or directory" for:

嗨,我收到一个 xcode“没有这样的文件或目录”:

#import "Three20Core.h"

I also note when I'm typing in the #import statement it recognises, and helps autocomplete, the "Three20Core.h" file, however when I compile I get the error?

我还注意到,当我输入 #import 语句时,它会识别并帮助自动完成“Three20Core.h”文件,但是当我编译时出现错误?

This is the main library file header for the Three20 library (from Facebook). So I've got the three20 directory at the same level as my app directory. In the Xcode application target build settings:

这是 Three20 库(来自 Facebook)的主库文件头。所以我的three20目录与我的应用程序目录处于同一级别。在 Xcode 应用程序目标构建设置中:

  1. Header Search Paths - "$(BUILT_PRODUCTS_DIR)/../../../three20" and recursive, and
  2. User Header Search Paths - same as above.
  1. 标题搜索路径 - “$(BUILT_PRODUCTS_DIR)/../../../three20”和递归,以及
  2. 用户标题搜索路径 - 同上。

Any fault finding advice?

任何故障查找建议?

采纳答案by Greg

Issue was my lack of understanding of the change in the Xcode 4 build system over Xcode 3. All that I had to do was set header paths to:

问题是我对 Xcode 4 构建系统相对于 Xcode 3 的变化缺乏了解。我所要做的就是将标头路径设置为:

 "$(BUILT_PRODUCTS_DIR)/../three20"
 "$(BUILT_PRODUCTS_DIR)/../../three20"

per http://three20.info/article/2011-03-10-Xcode4-Support

每个http://three20.info/article/2011-03-10-Xcode4-Support

回答by Richard Stelling

See an expanded version of this answer here: Xcode 4 Archive Version Unspecified

在此处查看此答案的扩展版本:Xcode 4 Archive Version Unspecified

I've found many issues with Xcode 4 when it comes to complex project structures.

当涉及到复杂的项目结构时,我发现 Xcode 4 存在很多问题。

  1. Create a group in your project called "Indexing"
  2. Drag the header files to this group
  3. When asked to select a target uncheck ALLtargets
  1. 在您的项目中创建一个名为“索引”的组
  2. 把头文件拖到这个组
  3. 当被要求选择一个目标时,取消选中所有目标

This has solved most of my Xcode 4 issues.

这已经解决了我的大部分 Xcode 4 问题。

Related questions:

相关问题:

回答by Lei Zhang

I just had another possible cause:

我还有另一个可能的原因:

After searching the whole folders, I found that there is another header file with the same file name but wrong path (and therefore it is missing to xcode). So make sure you don't have a duplicated header that has wrong path.

搜索整个文件夹后,我发现还有另一个文件名相同但路径错误的头文件(因此xcode缺少它)。因此,请确保您没有路径错误的重复标头。