我使用 GPUImage框架创建了一个示例应用程序来执行凹凸变形。我添加了这个框架到我的应用程序,但我看到以下错误: $ b
没有找到词法或预处理器问题'GPUImage.h'文件。
我已经将 -ObjC 标志添加到其他链接标志,但我仍然看到这个错误。我怎样才能解决这个问题,并让我的应用程序进行编译?
解决方案将GPUImage框架添加到XCode项目可能会非常棘手。所以,我已经添加了详细的分步说明w /图像如何做到这一点。
静态编译方法(详细的解决方案,所以我们不要乱up)
这是静态编译方法。在这个基本上,我们将使用./build.sh文件编译框架。只需将它添加到我们的XCode项目,然后配置XCode以正确使用它。
运行 ./ build.sh
注意:这将编译并为您的mac上的所有sdks创建随时可用的二进制文件。 build.sh创建一个名为 build 的文件夹,并生成已编译的二进制文件并将其转储到如下文件夹中: > Release-iPhone , Release-iPhoneOS , Release-iphonesimulator 等文件夹。
现在iPhone将 Release-iphone 拖放到您的XCode项目上。请确保选中复制到..选项。
注意:
在目标下的项目资源管理器>项目名称中选择您的项目,选择Build Phases>展开链接二进制库 >
将 libGPUImage.a 添加到链接二进制库部分。您可能需要右键点击 libGPUImage.a ,然后在Finder中打开,最后拖放它。
当我们在这里,还添加了以下GPUImage的依赖框架/库 CoreMedia,CoreVideo,OpenGLES,AVFoundation,QuartzCore 到链接二进制库 section
通过单击值字段打开标题搜索路径。
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.
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.
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头文件,该怎么办?
发布评论