XCode 3.1.2,找不到头文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2188778/
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 3.1.2, header file not found
提问by ravi
I have been trying to build a code that has dependencies with other header files that are not in the project directory. I added the paths to these header files in both HEADER_PATH and USER_PATH. However, I still see error while building. It says that the file is not found. I verified that the file exist in the path added to the header search path in project settings.
我一直在尝试构建一个与不在项目目录中的其他头文件有依赖关系的代码。我在 HEADER_PATH 和 USER_PATH 中添加了这些头文件的路径。但是,我在构建时仍然看到错误。它说找不到文件。我验证了该文件存在于项目设置中添加到标题搜索路径的路径中。
How do I make sure that all my header files referenced in the project is included and the paths are being picked by Xcode during compilation?
我如何确保项目中引用的所有头文件都包含在内,并且 Xcode 在编译期间选择了路径?
I tried copying all the files to the project with no luck. This is the first time iam using Xcode, so its kind of frustrating. Iam a linux guy and comfortable with make files. Is there a Make file for xcode which i can modify to include the header file directories.
我尝试将所有文件复制到项目中,但没有成功。这是我第一次使用 Xcode,所以有点令人沮丧。我是一个 linux 人,对 make 文件很满意。是否有 xcode 的 Make 文件,我可以修改它以包含头文件目录。
回答by Isaac Overacker
You might want to check the order of your source files in your target's build phases to ensure that your dependencies are compiled before your source files that reference them.
您可能需要检查目标构建阶段中源文件的顺序,以确保在引用它们的源文件之前编译依赖项。
- Select your project in the Project Navigator.
- Select your target.
- Click on the Build Phases tab.
- Click on Compile Sources to expand the section.
- Drag the dependencies to the top of the list.
- 在项目导航器中选择您的项目。
- 选择你的目标。
- 单击构建阶段选项卡。
- 单击编译源以展开该部分。
- 将依赖项拖到列表顶部。
回答by Paul R
Are you sure you spelled the header file name correctly ? Is the case correct ? Did you use user quotes "" rather than system quotes <> ?
您确定头文件名拼写正确吗?情况正确吗?您是否使用了用户引号 "" 而不是系统引号 <> ?
Assuming you've checked all the obvious things such as the above then one other thing to try is to quit Xcode, delete the "build" folder in your project directory, and try again - sometimes the build folder gets in a pickle internally.
假设您已经检查了所有明显的事情,例如上面的内容,那么另一件要尝试的事情是退出 Xcode,删除项目目录中的“build”文件夹,然后再试一次 - 有时 build 文件夹会在内部陷入困境。