为什么 XCode 4 在构建过程中找不到我的 .h 文件? [英] Why can't XCode 4 find my .h files during a build?

查看:32
本文介绍了为什么 XCode 4 在构建过程中找不到我的 .h 文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个无法构建的项目,因为编译器 (?) 似乎找不到 .h 文件.我尝试使用完整路径、相对路径并设置项目搜索路径(标题和用户标题),但似乎没有任何效果.我觉得很奇怪的是,即使使用完整路径,它也会出错:没有这样的文件或目录(该文件确实存在于指定的路径中).

I have a project that won't build because the compiler (?) can't seem to find the .h files. I have tried using the full path, relative path and setting the Project Search Paths (both Header and User Header) and nothing seems to work. What I find very strange is even with the full path it gives an error: No such file or directory (the file does indeed exist in the specified path).

有人可以就可能出现的问题提出一些建议吗?我当然会很感激.

Can anybody give some suggestions on what could be the problem? I would certainly appreciate it.

导入语句:

#import <Foundation/Foundation.h>
#import <zxing/common/Counted.h>
#import <zxing/Result.h>
#import <zxing/BinaryBitmap.h>
#import <zxing/Reader.h>
#import <zxing/ResultPointCallback.h>

标题位于:

/Users/rolfmarsh/iPhoneCodeLibrary/BarcodeLibrary/zxing-1.6/cpp/core/src/zxing

标题搜索路径为:

$(inherited)
"$(SRCROOT)/zxing/common"

/Users/rolfmarsh/iPhoneCodeLibrary/BarcodeLibrary/zxing-1.6/cpp/core/src

包含文件的完整路径:

/Users/rolfmarsh/iPhoneCodeLibrary/BarcodeLibrary/zxing-1.6/cpp/core/src/zxing/Result.h

推荐答案

我发布此内容是为了让像我这样在项目中集成 zxing qr 阅读器的新手更简单,并关闭几个相关的线程到zxing整合.

I am posting this in order to make things simple for newbies like me that are integrating zxing qr reader in their projects and to bring closure to a couple of threads related to zxing integration.

1.主要事情 - 绝对确保您拥有最新版本.

1. Main thing - Be absolutely sure you have the latest version.

http://zxing.googlecode.com/svn/trunk/

[现在,即 1 月 18 日,您将不会再遇到 zxing/common/文件夹的问题.最简单的解决方法:获取最新代码!]

[By now, January 18th, you will have no more issues with that zxing/common/ folder. Easiest fix for this: get the latest code!]

2.转到 zxing -> iphone -> ZXingWidget.

2. Go to zxing -> iphone -> ZXingWidget.

将 ZXingWidget.xcodeproj 文件拖放到 Xcode 项目的组和文件"侧栏的根目录上.

Drag ZXingWidget.xcodeproj file and drop it onto the root of your Xcode project's "Groups and Files" sidebar.

[您现在应该在那里列出 ZXingWidget.xcodeproj,它必须下拉并列出其内容]

[you should now have ZXingWidget.xcodeproj listed there and it has to drop down and list it's content]

3.在同一个地方,项目导航器,选择:

3. In the same place, project navigator, select:

您的项目文件 -> 目标 -> '您的项目名称' -> 构建阶段 -> 将二进制文件与库链接.

Your project file - > Targets -> 'your project name' -> Build phases -> Link binary with libraries.

您应该找到一个名为工作区"的文件夹.从内部添加libZXingWidget.a".

You should find a folder named 'Workspace'. Add 'libZXingWidget.a' from within.

4.仍处于构建阶段,展开目标依赖项并添加 ZXingWidget.

4. Still in Build phases, expand Target Dependencies and add ZXingWidget.

5.选择 Build Settings 并搜索 Header Search Paths.您需要向标题搜索路径添加 2 条记录.您不需要将值与用户标题搜索路径相关联.您可以通过双击右侧的列来实现此目的.将出现一个小的弹出窗口.使用 + 按钮添加第一条记录.添加:

5. Select Build Settings and search for Header Search Paths. You need to add 2 records to Header Search Paths. You do not need to associate values to User Header Search Paths. You achieve this by double clicking the column on the right. A small popover window will apear. Use the + button to add the first record. Add:

../zxing/iphone/ZXingWidget/Classes

../zxing/iphone/ZXingWidget/Classes

现在使用 + 按钮添加第二条记录.添加:

Now use the + button to add the second record. Add:

../zxing/cpp/core/src

../zxing/cpp/core/src

这些是我使用的值.这些值有效是因为我使用相同的文件夹来托管我的项目和 zxing 文件夹.

These are the values I use. These values work because I use the same folder to host both my project and the zxing folder.

[如果您决定使用不同的文件结构,请务必正确引用您的文件夹.]

[Be sure to refer your folder properly in case you decide to have a different file structure.]

6.返回到 Build Phases 并添加以下所需的 ios 框架:

6. Go back to Build Phases and add the following ios frameworks required:

AVFoundation

AVFoundation

音频工具箱

核心视频

核心媒体

libiconv

通讯录

地址簿界面

7.

创建一组文件 (.h&.m) 并将其 .m 扩展名更改为 .mm

Create a set of files (.h&.m) and change it's .m extension to .mm

8.通过在先前创建的文件中包含以下内容来测试集成:

8. Test the integration by including the following in the file previously created:

#import <ZXingWidgetController.h>
#import <QRCodeReader.h>

此时,只有当您运行的不是最新版本时,才会遇到丢失的文件.希望这会有所帮助.

At this point you should run into missing files only if you are not running the latest version. Hope this helps.

这篇关于为什么 XCode 4 在构建过程中找不到我的 .h 文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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