473,569 Members | 2,772 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Friend class and typedef problem

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<MetaDat a> 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 Telecommunicati e en Informatieverwe rking Tel: +32-(0)9-264 34 16
Universiteit Gent Fax: +32-(0)9-264 42 95
St-Pietersnieuwstr aat 41, B-9000 Gent, Belgium email: ab@telin.UGent. be
Jul 22 '05 #1
1 3130
"Alex Borghgraef" <ab@telin.diesp ammerdie.UGent. be> wrote in message
news:c0******** **@gaudi2.UGent .be
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<MetaDat a> 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<MetaDat a> ;
};
--
John Carson
1. To reply to email address, remove donald
2. Don't reply to email address (post here instead)

Jul 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
8564
by: Sebastian Faust | last post by:
Hi, is a construction like the following possible: template<class view_model> class template_clase { protected: template_clase() {} virtual ~template_clase() {}
0
1168
by: Oliver Kowalke | last post by:
Hi, following code will not compile with MS VC 7.1: struct null_type; template< bool B, typename T, typename E > struct if_then_else; template< typename T, typename E >
0
1169
by: Marc Schellens | last post by:
I have: template<class Sp> class Data_: public Sp { public: typedef typename Sp::Ty Ty; typedef Sp Traits; private:
10
4294
by: Der Andere | last post by:
I've got a problem concerning the << operator. Although I've declared it as a friend function it cannot access the private member of the class AVLtree. Some code: ------------------ class AVLtree { public: friend ostream& operator << (ostream& os, AVLtree& t){}; .... some unimportant stuff ...
5
1633
by: Gianni Mariani | last post by:
The code below compiles on gcc 3.4.0 and Comeau's 4.3.3 but MSVC++ 7.1 dies complaining about somthing <unknown>. Is this valid ? More to the point, is there any way of doing this that is supported across all 3 compilers ? I want a template to take a parameter and make it it's friend. <code>
4
2437
by: Justin Miller | last post by:
Ok, I tried to make that subject as descriptive as possible. What I'm trying to do: I'm attempting to use policies to create a generic memento (design pattern) template. My Memento template so far is pretty simple: using an idea of Andrei Alexandrescu (at least that's where I first read it) to create a lightweight way of overloading...
1
1423
by: Joe Carner via .NET 247 | last post by:
First time posting, thanks in advance for any help you can give me. Basically I am trying to a class that i want to be able to access the private data members of another class, both of which i created. But, I can't get the friend class to work. For example (this is not actually my code): template <typename Key, typename Value> class...
9
4024
by: rtalbot | last post by:
I've got a container that looks like this: template <class T> class Foo { public: Foo() : _data(), _status(1) { } Foo(T) : _data(T), _status(0) { } ~Foo() { }
2
2420
by: Immortal Nephi | last post by:
I design a class for general purpose. I do not allow a client to read or modify interface and implemention. I allow them to write a new non- member function outside of class' interface and implmention. The problem is that non-member function cannot access private data member. The friend keyword is not the solution. I am aware that friend...
0
7609
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7921
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7666
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7964
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6278
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5504
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2107
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.