Connecting Tech Pros Worldwide Forums | Help | Site Map

Friend class and typedef problem

Alex Borghgraef
Guest
 
Posts: n/a
#1: Jul 22 '05
Hi all,

I'm trying to get the Limp (Large Image Manipulation Program) library to
compile using gcc 3.2, and I've encountered some problems. One is that
the library systematically refers to friend classes as "friend ClassName",
which is easy to remedy by replacing "friend" with "friend class". But
this poses another problem: in the file metadata.h I encounter the
following code:

....
typedef AutoPtr<MetaData> MetaDataPtr;
....

class MetaData
{
...
friend class MetaDataPtr;
};

resulting in the error message:

metadata.h:151: using typedef-name `MetaDataPtr' after `class'

My question is obviously how to solve this problem, and whether this
"friend" vs. "friend class" is a result of the switch from gcc 2.95
(under which the author claims the library works) to gcc 3.2

--
Alexander Borghgraef
Vakgroep Telecommunicatie en Informatieverwerking Tel: +32-(0)9-264 34 16
Universiteit Gent Fax: +32-(0)9-264 42 95
St-Pietersnieuwstraat 41, B-9000 Gent, Belgium email: ab@telin.UGent.be

John Carson
Guest
 
Posts: n/a
#2: Jul 22 '05

re: Friend class and typedef problem


"Alex Borghgraef" <ab@telin.diespammerdie.UGent.be> wrote in message
news:c0dljh$8lm$1@gaudi2.UGent.be[color=blue]
> Hi all,
>
> I'm trying to get the Limp (Large Image Manipulation Program)
> library to compile using gcc 3.2, and I've encountered some problems.
> One is that the library systematically refers to friend classes as
> "friend ClassName", which is easy to remedy by replacing "friend"
> with "friend class". But this poses another problem: in the file
> metadata.h I encounter the following code:
>
> ...
> typedef AutoPtr<MetaData> MetaDataPtr;
> ...
>
> class MetaData
> {
> ...
> friend class MetaDataPtr;
> };
>
> resulting in the error message:
>
> metadata.h:151: using typedef-name `MetaDataPtr' after `class'
>
> My question is obviously how to solve this problem, and whether this
> "friend" vs. "friend class" is a result of the switch from gcc 2.95
> (under which the author claims the library works) to gcc 3.2[/color]

I don't understand why the typedef doesn't work but, at least with Comeau
Online, you can solve the problem by just not using the typedef, i.e.,

class MetaData
{
...
friend class AutoPtr<MetaData> ;
};


--
John Carson
1. To reply to email address, remove donald
2. Don't reply to email address (post here instead)

Closed Thread