13

I am trying to set up GPUImage in a project but I am not able to track down why I'm getting the error: "GPUImage.h" not found. I have added the framework, setup the target dependency, added the Header Search path as: framework, and added other linker flag -ObjC. Still no luck. I have included my super simple test project here and linked below if anyone wants to take a look.

I know this must be documented and basic, but I searched on GitHub but did not find reference to this particular issue.

Thanks for reading.

owolf.net/uploads/StackOverflow/GPUITest.zip

Mick MacCallum
  • 124,539
  • 40
  • 277
  • 276
Mr Wolf
  • 4,766
  • 15
  • 55
  • 91

4 Answers4

15

Your path has to be relative to the actual directory location relative to the project file. If you change it to this:

GPUITest3/BradLarson-GPUImage-f67cbd9/framework/**

then it will work just fine.

David H
  • 39,114
  • 12
  • 86
  • 125
  • 1
    To be safe, I'd go with `./GPUITest3/BradLarson-GPUImage-f67cbd9/framework/Source/**`, making sure to point out that you need to choose the recursive option to the right of the path. The project still has two undefined variables within it, so it won't compile, but that will do away with the missing header errors. – Brad Larson Aug 24 '12 at 14:24
  • The trailing '**' is the Recursive option (in text) so already thought of that. I've never prepended my header searches with "./" but for sure it won't hurt. – David H Aug 24 '12 at 14:50
  • 1
    I've found that people don't recognize the ** as being recursive (vs the * for not), so I've taken to explicitly pointing that out. It sometimes avoids further questions. – Brad Larson Aug 24 '12 at 14:51
  • Thank you so much David. It really worked for me. Could you please tell why my code is crashing on GPUImageView *filterView = (GPUImageView *)self.view; [filter addTarget:filterView]; I have set the class for my self.view as GPUImageView already. Still it is crashing and saying Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView nextAvailableTextureIndex]: unrecognized selector sent to instance 0x20875f30' – Swati Jan 22 '13 at 10:59
  • @SwatiWadhera log the class of self.view - my guess it is not what you think it is. – David H Jan 22 '13 at 12:57
  • GPUITest3/BradLarson-GPUImage-f67cbd9/framework/** Where we should set this path? – The X-Coder Feb 06 '13 at 14:13
5

from github readme file(step 1 ~ 3):

  1. Start by dragging the GPUImage.xcodeproj file into your application's Xcode project to embed the framework in your project.

  2. go to your application's target and add GPUImage as a Target Dependency.

  3. you'll want to drag the libGPUImage.a library from the GPUImage framework's Products folder to the Link Binary With Libraries build phase in your application's target.

  4. if you meet following errors

    “GPUImage.h” not found
    

    then the straightforward way is to add the directory to your header search paths:

    PathToGpuFramework/frameworksource
    PathToGpuFramework/frameworksource/iOS
    
lbsweek
  • 4,230
  • 37
  • 37
1

I spent more than 2 hours on this issue, read almost every answer on the web, Found the best solution.

1.Copy the GPUImage folder inside your own Project Folder. Also, drag and drop the 'GPUImage.xcodeproj' into your project inside Xcode.

2.Inside Xcode, in the select "Search header paths", press Enter/return, type $(PROJECT_DIR), press Enter/return and then double-click on it and change "non-recursive" to "recursive".

P.S - The $(PROJECT_DIR) command will automatically fill up the path to the GPUImage header files.

0

For some reason, I have NEVER been able to make this work with the Search Header paths.

My solution: in Prefix-pch (or wherever you want to import it, but Prefix-pch is easiest), #import "framework/Source/GPUImage.h" - maybe this is what you are supposed to do, maybe not. I don't really know, but the directions say just to use #import "GPUImage.h"

Also note that if you follow the directions in the readme, and simply drag the GPUImage framework to your project, you are only creating a reference. The library will still be in your downloads folder or wherever you unzipped it. This doesn't work for me bc all of my projects are in Dropbox for cloud backup and use on multiple machines. The way in the directions might be how some people like to do it. It might even be a best practice for all I know, but I like to have each project be self contained. My solution to that is to drag the zip file downloaded from github to my project folder and unzip it there. THEN drag the GPUImage project file to your project in xcode.

Hope this helps.