Friend class and typedef problem

A

Alex Borghgraef

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
 
J

John Carson

Alex Borghgraef said:
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

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> ;
};
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top