Friend class and typedef problem

Discussion in 'C++' started by Alex Borghgraef, Feb 11, 2004.

  1. 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:
     
    Alex Borghgraef, Feb 11, 2004
    #1
    1. Advertising

  2. Alex Borghgraef

    John Carson Guest

    "Alex Borghgraef" <> wrote in message
    news:c0dljh$8lm$
    > 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> ;
    };


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

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alex Vinokur
    Replies:
    1
    Views:
    365
    mlimber
    Jun 6, 2006
  2. Jim Langston
    Replies:
    6
    Views:
    323
    Jim Langston
    Aug 22, 2006
  3. request@no_spam.com
    Replies:
    5
    Views:
    431
  4. oor
    Replies:
    0
    Views:
    1,357
  5. Peter
    Replies:
    2
    Views:
    278
    Öö Tiib
    Jun 6, 2013
Loading...

Share This Page