include problem (please help!)

From: Stefan Rieken <StefanRieken_at_SoftHome.net>
Date: Sat, 05 Aug 2000 14:57:09 +0200

Hi,

I do not like to bother you all at a ratio that I do now, but I am
really stuck with this problem, and I can't find a way out. It has put
my programming activity to zero for the past week or so, while I was
planning to do very much in that time :-(

The problem is that I have to include object Foo in object Bar, and vice
versa, like this:

--foo.gob--

%h{
#include "bar.h"
%}

class Bar from Gtk:Object {
        private Foo * foo;

        void change_foo (Bar * self, Foo * foo) {
                self->_priv->foo = foo;
        }
}

--bar.gob--

%h{
#include "foo.h"
%}

class Bar from Gtk:Object {
        private Bar * bar;

        void change_bar (Foo * self, Bar * bar) {
                self->_priv->foo = foo;
        }
}

--end of files--

Just try to compile this: first with gob and then with gcc -c . In spite
of the stupid names (foo and bar), I think this is a "working" example
-- except that it does NOT work, because the headers keep wanting to
include each other, which they don't do, because of #ifdef's, which
causes parse errors that I cannot solve.

How on earth can I have my Foo know all about Bar that he needs (this
includes its public data structure), and vice versa, from Gob?

I mean, I can make major changes in the headers by hand, but that would
be stupid, because I had to redo that every time when the objects were
regenerated.

Thanks in advance,

Stefan
Received on Sat Aug 05 2000 - 05:56:23 CDT

This archive was generated by hypermail 2.2.0 : Sun Apr 17 2011 - 21:05:02 CDT