static friends

Lubos Lunak l.lunak at suse.cz
Mon Aug 25 10:40:12 BST 2003


Dne čt 21. srpna 2003 22:59 Leo Savernik napsal(a):
> Am Donnerstag, 21. August 2003 22:18 schrieb Rolf Magnus:
> > On Thursday 21 August 2003 22:15, Leo Savernik wrote:
>
> [...]
>
> > First do the normal declaration, then the friend declaration. I.e.:
> >
> > static void foo();
> >
> > class bar {
> >     friend void foo();
> > };
>
> Yeah, thanks! That did it :-)
>
> Though I now get a "`void foo()' declared `static' but never defined"
> warning in every other compilation unit including the class, but I can
> safely ignore this.

 Put the forward declaration with 'static' in the .cpp file, before including 
the .h file. That will take care of it.

-- 
Lubos Lunak
KDE Developer
l.lunak at suse.cz     l.lunak at kde.org





More information about the kfm-devel mailing list