www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/04/00:31:45

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: strange parse error
Date: Tue, 04 Nov 1997 07:52:29 +0000
Organization: Two pounds of chaos and a pinch of salt
Lines: 29
Message-ID: <345ED43D.3D28@cs.com>
References: <345E74D8 DOT 6D04B23B AT agri DOT huji DOT ac DOT il>
Reply-To: fighteer AT cs DOT com
NNTP-Posting-Host: ppp227.cs.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019