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 portals
, but each portal
needs to reference a room. Here is a cut-back version of the code:
typedef struct {
Portal portals[10];
} Room;
typedef struct {
Room *destinationRoom;
} Portal;
Any suggestions on how to achieve this? I tried adding a forward declaration of struct Portal;
to the top of the file but it didn't help.
Using the following code:
typedef struct Room Room;
typedef struct Portal Portal;
struct Room {
Portal portals[10];
};
struct Portal {
Room *destinationRoom;
};
Gives me this error:
parse error: token -> 'Room' ; column 11
*** Error in `/opt/gbdk/bin/sdcc': munmap_chunk(): invalid pointer: 0xbfe3b651 ***