Mail Archives: djgpp/1997/09/01/08:03:24
On Sun, 31 Aug 1997 20:24:05 -0400, Mark Augustyn <augustyn DOT 3 AT osu DOT edu>
wrote:
>I hate to ask a dumb question but is this the appropriate way to declare
>a struct:
>
>struct cell {
> int terrain;
> BITMAP *tile;
>};
[snip]
>What am I missing? Do I need to include something to use structs and
>classes?
>
>Please help before I seriously injure the wall with my head.
>Mark.
I had similar trouble when moving from Turbo C++ to DJGPP; evidently,
TC++ allows some seriously nonstandard C++ style code in C programs.
Anyway, here's a syntax I've found to work well (it's the same one
used in the Allegro source code, as that's how I figured out this
form):
typedef struct CELL {
int terrain;
BITMAP *tile;
} CELL;
/* then, later: */
CELL mycell; /* or whatever */
The capitalization of 'CELL' is just my preference; C lets you
capitalize any way you like in this form just as it does elsewhere.
Hope that helps...
Nathan Thompson
---------------
Remove 'no.spam' to reply.
- Raw text -