title: Forward declaration of typedef structs in GBDK C
body: <p>I'm using GBDK C to create a Game for the original Game Boy, and I have run in to a little problem. Each room in my game needs to have different <code>portals</code>, but each <code>portal</code> needs to reference a room. Here is a cut-back version of the code:</p>
  
  <pre><code>typedef struct {
      Portal portals[10];
  } Room;
  
  typedef struct {
      Room *destinationRoom;
  } Portal;
  </code></pre>
  
  <p>Any suggestions on how to achieve this? I tried adding a forward declaration of <code>struct Portal;</code> to the top of the file but it didn't help.</p>
  
  <hr>
  
  <p>Using the following code:</p>
  
  <pre><code>typedef struct Room Room;
  typedef struct Portal Portal;
  
  struct Room {
      Portal portals[10];
  };
  
  struct Portal {
      Room *destinationRoom;
  };
  </code></pre>
  
  <p>Gives me this error:</p>
  
  <pre><code>parse error: token -&gt; 'Room' ; column 11
  *** Error in `/opt/gbdk/bin/sdcc': munmap_chunk(): invalid pointer: 0xbfe3b651 ***
  </code></pre>