Pete Becker
11/11/2008 10:22:00 PM
On 2008-11-11 16:19:07 -0500, "Hicham Mouline" <hicham@mouline.org> said:
> Hello,
>
> I am attempting to change a existing large code base and I have this
> situation:
>
> A.hpp
> class A {
> ....
> friend void B::member_function1() const;
> ...
> };
>
>
> When I include B.hpp for the definition of B, I seem to fall in
> cross-include situation where the include guards
> don't work (or work bad...)
>
> I tried forward declaring class B before A, but it seems the full definition
> of B is required
> to declare its member function as a friend to A.
>
> Is there a solution to this?
>
Sure. Put the full definition of B before the definition of A. Since
you haven't shown any other code, it's impossible to guess the causes
of whatever other problems you've been running into.
--
Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com) Author of "The
Standard C++ Library Extensions: a Tutorial and Reference
(www.petebecker.com/tr1book)