From: johne AT parallax DOT co DOT uk (John Eccleston) Newsgroups: comp.os.msdos.djgpp Subject: Re: Funky include files Date: Tue, 18 Feb 97 08:51:25 GMT Organization: Parallax Solutions Ltd Message-ID: <856255890.343812@red.parallax.co.uk> References: <19970217 DOT 174351 DOT 7567 DOT 2 DOT fwec AT juno DOT com> NNTP-Posting-Host: red.parallax.co.uk Cache-Post-Path: red.parallax.co.uk!unknown AT parsnip DOT parallax DOT co DOT uk Lines: 54 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Mark wrote: >Here's my problem... >(please don't comment on my programming form, I know it needs work) > [Code snipped] > >As you can see, these two classes are friends of each other. >This means that each has a reference to the other within its >definition. Before lindef will mean anything to the compiler, >the class has to be defined. So I put lindef in front of vertex. > >Now, of course, when the compiler gets to vertex, lindef means >nothing, so I get an error. If I switch them, the same thing will >happen. > >What can I do? > >Can you make the compiler do more than one pass? > >HELP? > >TIA > >-Fwec > Hi Mark, Try using a forward declaration (before declaring class vertex) thus: class lindef; Which will tell the compiler that a definition will follow and should get around your problem. Hope this helps John ________________________________________________________________ Parallax Solutions Ltd. Tel.: 01203 514522 Stonecourt, Fax.: 01203 514401 Siskin Drive, Web : http://www.parallax.co.uk/~johne Coventry CV3 4FJ Mail: johne AT parallax DOT co DOT uk ________________________________________________________________ Remember: There is no such thing as computer error, it's 100% YOUR fault ________________________________________________________________