Cocoa Bundle Project compiled ERRORs

Discussion in 'Mac Programming' started by youngplayer, Jul 8, 2008.

  1. youngplayer macrumors member

    Joined:
    May 16, 2008
    Location:
    Shanghai,China
    #1
    I'm following the guide from developer.apple.com to implement a PreferencePane.

    I create a cocoa bundle project, and add the PreferencePanes framework.
    And then, I create a class MyPreferencePane inheriting class NSPreferencePane.
    It's strange that there's no prompt from the code sense when I type NSPreferencePane. So, I guess there're some problem happened. When I compile the project, there occur four errors:
    1) NSPreferencePane.h:No such file or directory
    2) Can't find interface declaration for 'NSPreferencePane'

    Both of the above errors occured twice.

    These errors seem invoked by no PreferencePane class found. But I have added PerferencePanes framework. How can these errors happen? I'm so puzzled.
     
  2. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    NSPreferencePane.h is part of the PreferencePanes.framework framework. Is this included in your project? It's part of the PreferencePane project template, but not any other template. If you chose Cocoa bundle or any project template other than PreferencePane you'll have to add it yourself.
     
  3. youngplayer thread starter macrumors member

    Joined:
    May 16, 2008
    Location:
    Shanghai,China
    #3
    I have added PreferencePane framework. Is it enough? What else should I do?
     
  4. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #4
    I've no idea as you've not told us if this fixed the errors, caused more errors etc.
     
  5. youngplayer thread starter macrumors member

    Joined:
    May 16, 2008
    Location:
    Shanghai,China
    #5
    How to add it by myself? I'm not sure how to do according to your first advice
     
  6. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #6
    I'm at work so I can't post the exact steps (not on a Mac), sol read the XCode documentation. It's there to tell you how to use the IDE.

    In general you should be able to drag it from the Finder to the Frameworks section of the project.
     
  7. youngplayer thread starter macrumors member

    Joined:
    May 16, 2008
    Location:
    Shanghai,China
    #7
    Ok, let me show my steps to add the PreferencePanes framework:
    1) Right click the "Linked Frameworks", and select "Add" -> "Existing Frameworks"
    2) Select PreferencePanes.framework from the Library/Frameworks folder
    3) Press "Add" button. And then, the "PreferencePanes.framework" is shown in the "Linked Frameworks"

    After that, the guide tells "Drag the header file to the nib's main window in IB". I failed to do this, because the guide is based on Project builder which may be different from Xcode which I'm using.

    What's the corresponding action in Xcode to the action "Drag the header file to the nib's main window in IB" in Project builder?
     

Share This Page