forward class warning

  • In Leopard I opened a project I created in Tiger.  It now gets 3
    warnings, just like the following:

    warning: PreferenceController  is a forward class and corresponding
    @interface may not exist.

    PreferenceController is a NSWindowController subclass. I can't find
    anything about "forward class" when searching Apple's Developer
    Connection web site (not surprising).  Can anyone explain to me what
    this warning means?

    Thanks in advance.
  • On Nov 14, 2007, at 10:56 PM, <cocoalist...> wrote:

    > In Leopard I opened a project I created in Tiger.  It now gets 3
    > warnings, just like the following:
    >
    > warning: PreferenceController  is a forward class and corresponding
    > @interface may not exist.
    >
    > PreferenceController is a NSWindowController subclass. I can't find
    > anything about "forward class" when searching Apple's Developer
    > Connection web site (not surprising).  Can anyone explain to me what
    > this warning means?

    It means you declared an @class somewhere but did not include a more
    concrete definition anywhere. In Xcode 2.x and earlier, GCC didn't
    really care if you did that, but starting in Leopard, it does. You
    probably just need to add a #import on the proper file at the top of
    the implementation.

    Nick Zitzmann
    <http://www.chronosnet.com/>
  • Nick is right, added  #import "PreferenceController.h" at the class that
    uses PreferenceController should work.

    John

    On 11/15/07, Nick Zitzmann <nick...> wrote:
    >
    >
    > On Nov 14, 2007, at 10:56 PM, <cocoalist...> wrote:
    >
    >> In Leopard I opened a project I created in Tiger.  It now gets 3
    >> warnings, just like the following:
    >>
    >> warning: PreferenceController  is a forward class and corresponding
    >> @interface may not exist.
    >>
    >> PreferenceController is a NSWindowController subclass. I can't find
    >> anything about "forward class" when searching Apple's Developer
    >> Connection web site (not surprising).  Can anyone explain to me what
    >> this warning means?
    >
    >
    > It means you declared an @class somewhere but did not include a more
    > concrete definition anywhere. In Xcode 2.x and earlier, GCC didn't
    > really care if you did that, but starting in Leopard, it does. You
    > probably just need to add a #import on the proper file at the top of
    > the implementation.
    >
    > Nick Zitzmann
    > <http://www.chronosnet.com/
    >
previous month november 2007 next month
MTWTFSS
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    
Go to today