Mail Archives: djgpp/1997/11/04/00:31:45
Fleminge wrote:
>
> I am writing a game using djgpp,allegro and rhide. When I write:
> struct ball{int x,y;} i get a "parse error before {". if i change the
> name from "ball" to somthing else, like "ball_" this problem disappers,
> but i get a "parse error before ."when i try to acces the variables in
> the "ball_" struct. can someone please help me out?
> i am attaching the file to this meesage.
You have several significant problems in this code. First, you don't
say whether you are building it as C or C++. If you're using C, then
you are making a number of serious syntactical errors: nonconstant
initializers, variables in the middle of blocks, etc.. If you're using
C++, then I don't see why, as you use no C++ constructs except for what
I've mentioned here, and there's no reason to use C++ just for them. I
also got a number of other errors and warnings when I tried to compile
your code (the fact that I don't have your header file notwithstanding).
However, your main problem is this: you never define any variables of
type 'ball'. Having a struct definition isn't enough; you must define
an actual variable in order to use it.
--
---------------------------------------------------------------------
| John M. Aldrich | "Autocracy is based on the assumption|
| aka Fighteer I | that one man is wiser than a million |
| mailto:fighteer AT cs DOT com | men. Let's play that over again, |
| http://www.cs.com/fighteer | too. Who decides?" - Lazarus Long |
---------------------------------------------------------------------
- Raw text -