[NOOB] Adding a header file to an XCode project

Discussion in 'Mac Programming' started by mysterytramp, Nov 8, 2008.

  1. mysterytramp macrumors 65816

    mysterytramp

    Joined:
    Jul 17, 2008
    Location:
    Maryland
    #1
    I'm sure this is the kind of question that will lead to an RTFM answer, but I'm not having any luck ...

    I d/l'd the Paintbrush source from Sourceforge to see what I could learn. XCode won't compile the source because of this line:

    #import <Sparkle/Sparkle.h>

    in AppController.h, and for this line:

    Code:
    [[NSNotificationCenter defaultCenter] addObserver:self
    			selector:@selector(killTheSheet:) 
    			name:SUUpdaterWillRestartNotification 
    			object:nil];
    
    
    I found "Sparkle.h" via google (And I'm assuming the second line doesn't compile because it's contained in SUUpdater.h, which is in Sparkle ... )

    Now the question is how do I get it in the project. I added the file to the project window, but XCode acts like it's not there. I figured Sparkle.h should be in the same directory as stdio.h, that didn't work either. And considering that you need to provide a password to get into the include folder, I'm guessing fooling with that folder is unwise.

    mt
     
  2. Cromulent macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #2
    Sparkle is actually a framework. You need to add the whole thing.

    Sometimes just adding a header file will work but often the headers also requires a library / framework as well that you must add.
     
  3. lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #3
    http://sparkle.andymatuschak.org/

    Go grab Sparkle from that URL.

    You need headers for the compiler to know what's available, you need the library that actually contains the implementations for the linker.

    -Lee
     
  4. mysterytramp thread starter macrumors 65816

    mysterytramp

    Joined:
    Jul 17, 2008
    Location:
    Maryland
    #4
    The framework was installed within the Paintbrush source. The header file wasn't. The easiest thing to do seemed to remove the Sparkle.framework then reinstall following the instructions at sparkle.andymatuschak.org. Now the build is failing on a linker error:

    Code:
    pbxcp: warning: couldn't strip: ... /Release/Paintbrush.app/Contents/Frameworks/Sparkle.framework/Versions/A/Resources/relaunch: No such file or directory
    
    Is relaunch a part of Sparkle? (As in ... you update the software then relaunch?)

    Y'know, for all this trouble, I thought I could comment out the two original offending lines of code. That causes even more problems.

    Ugh ...

    mt
     
  5. Cromulent macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #5
    Okay here are the steps.

    Download the Sparkle framework and add it to your frameworks folder (/System/Library/Frameworks).

    Download the source code from wherever you got it from.

    The project should already have the framework in it and should find the framework because it is installed in the correct place. All should be happy.

    Click Build and Go! Enjoy.

    Any other problems let me know.
     

Share This Page