如果我找不到GPUImage框架的GPUImage.h头文件,该怎么办? [英] What should I do if I can't find the GPUImage.h header for the GPUImage framework?

查看:1273
本文介绍了如果我找不到GPUImage框架的GPUImage.h头文件,该怎么办?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 GPUImage框架创建了一个示例应用程序来执行凹凸变形。我添加了这个框架到我的应用程序,但我看到以下错误:
$ b


没有找到词法或预处理器问题'GPUImage.h'文件。

我已经将 -ObjC 标志添加到其他链接标志,但我仍然看到这个错误。我怎样才能解决这个问题,并让我的应用程序进行编译?

解决方案

将GPUImage框架添加到XCode项目可能会非常棘手。所以,我已经添加了详细的分步说明w /图像如何做到这一点。



静态编译方法(详细的解决方案,所以我们不要乱up)

这是静态编译方法。在这个基本上,我们将使用./build.sh文件编译框架。只需将它添加到我们的XCode项目,然后配置XCode以正确使用它。


  1. 从Github下载GPUImage并提取它

  2. 转到终端中的 GPUImage 文件夹
  3. 运行 ./ build.sh

    注意:这将编译并为您的mac上的所有sdks创建随时可用的二进制文件。 build.sh创建一个名为 build 的文件夹,并生成已编译的二进制文件并将其转储到如下文件夹中: > Release-iPhone Release-iPhoneOS Release-iphonesimulator 等文件夹。


  4. iPhone使用 Release-iphone (这也适用于模拟器)。
  5. 复制(而不是拖放) Release-iphone XCode项目的根目录,以便我们有一个本地的框架副本。

  6. 现在iPhone将 Release-iphone 拖放到您的XCode项目上。请确保选中复制到..选项。



    注意:


    • Release-iphone 文件夹包含两个子文件夹: include lib include 文件夹包含所有头文件 .h 文件

    • lib 文件夹包含已编译的二进制版本文件,名为 libGPUImage .a

    • 现在我们需要简单地配置XCode来使用.h和.a文件。**

  7. >
  8. 目标下的项目资源管理器>项目名称中选择您的项目,选择Build Phases>展开链接二进制库 >


  9. libGPUImage.a 添加到链接二进制库部分。您可能需要右键点击 libGPUImage.a ,然后在Finder中打开,最后拖放它。

  10. >

    当我们在这里,还添加了以下GPUImage的依赖框架/库
    CoreMedia,CoreVideo,OpenGLES,AVFoundation,QuartzCore 链接二进制库 section


    .h 标题。 在项目资源管理器中选择项目>目标>选择构建设置>,然后输入搜索路径以查看搜索路径部分。

    通过单击值字段打开标题搜索路径 拖放 lib 文件夹。注意:如果显示绝对路径,请将其更改为 $(SRCROOT)/ path / to / lib / 。 (你应该有相对于你的xcode项目的框架,见第6步) 重复11& 12也可用于图书馆搜索路径


  11. 其他提示:您可以将 .h 文件添加到图书馆搜索路径标题搜索路径,你可以使它们递归。我有一个名为 Dependencies 的主文件夹,我保留了所有的依赖项,比如MySDK-framework,包括Release-iPhone。而且我在Dependencies(根文件夹)中只有一个搜索路径,并使其成为递归


    I have created a sample application to perform bump distortion, using the GPUImage framework. I added this framework to my application, but I'm seeing the following error

    Lexical or preprocessor issue 'GPUImage.h' file not found.

    I have added the -ObjC flag to the Other Linker Flags, but I'm still seeing this error. How can I solve this problem and get my application to compile?

    解决方案

    Adding GPUImage framework to XCode project could be tricky. So I haved added detailed step-by-step instructions w/ images on how to do it.

    Static Compilation Method (detailed solution so we don't mess up)

    This is Static compilation method. In this basically we will compile the framework using ./build.sh file. And simply add it to our XCode project, then configure XCode to properly use it.

    1. Download GPUImage from Github and extract it (or just clone it).
    2. Go to the GPUImagefolder in terminal
    3. Run ./build.sh

      Note: This will compile and create ready-to-use binary for all the sdks on your mac.

    4. build.sh creates a folder called build and generates compiled binaries and dumps them to folders like: Release-iPhone, Release-iPhoneOS, Release-iphonesimulator etc folders.

    5. For iPhone use Release-iphone (This also works for simulator).
    6. Copy (not drag-drop) Release-iphone to your XCode project's root directory so that we have a local copy of framework.
    7. Now iPhone drag-and-drop Release-iphone onto your XCode project. Make sure to check "Copy to .." option.

      Note:

      • This Release-iphone folder contains two sub-folders: include and lib
      • include folder contains all the header .h files
      • lib folder contains compiled binary version file called libGPUImage.a
      • We now need to simply configure XCode to use .h and .a files.**
    8. Select your project in the project explorer > Project name under Targets > select Build Phases > Expand Link Binary With Libraries

    9. Add the libGPUImage.a to Link Binary With Libraries section. You may want to Right-click on libGPUImage.a then Open in Finder and finally drag-drop it.

    10. While we are at it, also add the following GPUImage's dependent frameworks/ libraries CoreMedia, CoreVideo, OpenGLES, AVFoundation, QuartzCore to Link Binary With Libraries section

    11. Now, lets configure .h headers.

    12. Select your project in the project explorer > Project name under Targets > select Build Settings > and type search paths to see search paths section.

    13. Open Headers Search Paths by clicking on the value field.

    14. Drag-and-drop the lib folder to that popup. Note: If it shows absolute path, change it to looks $(SRCROOT)/path/to/lib/. (You should have the framework relative to your xcode project see step 6).

    15. Repeat 11 & 12 for Library Search Paths as well.

    Additional tips: You can add .h files to Library Search Paths or Headers Search Paths, you can make them Recursive. I have a main root-folder called Dependencies folder where I keep all the dependencies like MySDK-framework including Release-iPhone. And I just have one search-path at the Dependencies (root folder) and made it recursive.

    这篇关于如果我找不到GPUImage框架的GPUImage.h头文件,该怎么办?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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