Topic: BC++ problem
Author: bit@cyberworld.edu (chang)
Date: 29 Nov 1994 21:15:15 GMT Raw View
Dear Netters:
I got a error msg from my code. It looks like:
class A{
public:
A(){};
~A(){};
B *b;
};
class B{
public:
B(){};
~B(){};
A *a;
};
Which passed in gnu gcc in UNIX. The error msg is:
Do not know B, type missed...
CAn anyone help me?
Thanks
Chang
Author: pm214@lu.erisoft.se (Peter Mustel)
Date: 30 Nov 1994 07:28:55 GMT Raw View
In article 6ao@kasey.umkc.edu, bit@cyberworld.edu (chang) writes:
>
> Dear Netters:
>
> I got a error msg from my code. It looks like:
>
> class A{
> public:
> A(){};
> ~A(){};
> B *b;
> };
>
> class B{
> ...
You must do a forward declaration of B. That is:
class B;
class A{
... (rest of the code)
---
_O/ . ______________________________________________________________
\_/ / - NeIm - Peter Mustel
|/ / - kOmP - Erisoft
./ / - FoNe - +46 920-42947
__________/ - mAlE - Peter.Mustel@lu.erisoft.se
Author: c23jrg@kocrsv01.delcoelect.com (John Goodrich)
Date: Wed, 30 Nov 94 15:46:08 EST Raw View
In article <3bg5l3$6ao@kasey.umkc.edu>, bit@cyberworld.edu says...
>
>
>Dear Netters:
>
>I got a error msg from my code. It looks like:
>
>class A{
>public:
> A(){};
> ~A(){};
> B *b;
>};
>
>class B{
>public:
> B(){};
> ~B(){};
> A *a;
>};
>
>Which passed in gnu gcc in UNIX. The error msg is:
>Do not know B, type missed...
>CAn anyone help me?
>Thanks
>Chang
>
>
>
You need a forward declaration of B before the declaration of A. Add:
class B;
to the beginning and you should be set.
--
John Goodrich addresses too numerous to list...
"It's hard to give democracy to cows. Not enough of them would
vote to be hamburgers." - P.J. O'Rourke