找不到GPUImage框架的GPUImage.h头文件怎么办? [英] What should I do if I can't find the GPUImage.h header for the GPUImage framework?
问题描述
我使用 GPUImage 框架创建了一个示例应用程序来执行凹凸变形.我将此框架添加到我的应用程序中,但我看到以下错误
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
词法或预处理器问题GPUImage.h"文件未找到.
Lexical or preprocessor issue 'GPUImage.h' file not found.
我已将 -ObjC
标志添加到其他链接器标志,但我仍然看到此错误.如何解决这个问题并使我的应用程序编译?
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?
推荐答案
将 GPUImage 框架添加到 XCode 项目可能会很棘手.因此,我添加了详细的分步说明,并附有关于如何操作的图片.
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.
静态编译方式(详细的解决方法,免得大家乱来)
这是静态编译方法.在这基本上我们将使用 ./build.sh 文件编译框架.只需将其添加到我们的 XCode 项目中,然后配置 XCode 以正确使用它.
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.
- 从 Github 下载 GPUImage 并提取它(或只是克隆它).
- 转到终端中的
GPUImage
文件夹 运行 ./build.sh
注意:这将为您的 mac 上的所有 sdks 编译和创建即用型二进制文件.
build.sh 创建一个名为 build 的文件夹并生成编译后的二进制文件并将它们转储到以下文件夹中:Release-iPhone、Release-iPhoneOS、Release-iphonesimulator 等文件夹.
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.
现在将 iPhone 拖放 Release-iphone 到您的 XCode 项目中.确保选中复制到.."选项.
Now iPhone drag-and-drop Release-iphone onto your XCode project. Make sure to check "Copy to .." option.
注意:
- 这个 Release-iphone 文件夹包含两个子文件夹:include 和 lib
- include 文件夹包含所有头文件 .h
- lib 文件夹包含名为 libGPUImage.a 的已编译二进制版本文件
- 我们现在需要简单地配置 XCode 以使用 .h 和 .a 文件.**
- 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
将 libGPUImage.a 添加到 Link Binary With Libraries 部分.您可能希望右键单击 libGPUImage.a,然后在 Finder 中打开,最后将其拖放.
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.
在我们完成的同时,还要添加以下 GPUImage 的依赖框架/库CoreMedia、CoreVideo、OpenGLES、AVFoundation、QuartzCore 到 将二进制文件与库链接 部分
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
现在,让我们配置 .h 标头.
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.
通过点击值字段打开标题搜索路径.
将 lib 文件夹拖放到该弹出窗口.注意:如果显示绝对路径,请将其更改为 $(SRCROOT)/path/to/lib/.(您应该拥有与 xcode 项目相关的框架,请参阅第 6 步).
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).
重复 11 &12 也适用于图书馆搜索路径.
Repeat 11 & 12 for Library Search Paths as well.
附加提示:您可以将.h 文件添加到库搜索路径 或标题搜索路径,您可以使它们递归>.我有一个名为 Dependencies 的主根文件夹,我在其中保存了所有依赖项,例如 MySDK-framework,包括 Release-iPhone.我在依赖项(根文件夹)只有一个搜索路径,并使其递归.
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屋!