如果我找不到GPUImage框架的GPUImage.h头文件,该怎么办?

编程入门 行业动态 更新时间:2024-10-25 10:31:31
本文介绍了如果我找不到GPUImage框架的GPUImage.h头文件,该怎么办?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

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

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

解决方案

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

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

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

  • 从Github下载GPUImage并提取它
  • 转到终端中的 GPUImage 文件夹
  • 运行 ./ build.sh

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

  • iPhone使用 Release-iphone (这也适用于模拟器)。
  • 复制(而不是拖放) Release-iphone XCode项目的根目录,以便我们有一个本地的框架副本。
  • 现在iPhone将 Release-iphone 拖放到您的XCode项目上。请确保选中复制到..选项。

    注意:

    • Release-iphone 文件夹包含两个子文件夹: include 和 lib include 文件夹包含所有头文件 .h 文件
    • lib 文件夹包含已编译的二进制版本文件,名为 libGPUImage .a
    • 现在我们需要简单地配置XCode来使用.h和.a文件。**
  • >
  • 在目标下的项目资源管理器>项目名称中选择您的项目,选择Build Phases>展开链接二进制库 >

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

  • >

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

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

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

  • 其他提示:您可以将 .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.

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

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

  • 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.

  • For iPhone use Release-iphone (This also works for simulator).
  • Copy (not drag-drop) Release-iphone to your XCode project's root directory so that we have a local copy of framework.
  • 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.**
  • Select your project in the project explorer > Project name under Targets > select Build Phases > Expand Link Binary With Libraries

  • 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.

  • 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

  • Now, lets configure .h headers.

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

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

  • 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).

  • 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头文件,该怎么办?

    本文发布于:2023-10-18 12:16:55,感谢您对本站的认可!
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:我找不到   框架   头文件   GPUImage

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!