delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/07/08/01:36:26

Message-ID: <37843732.BEE47245@vetec.com>
Date: Thu, 08 Jul 1999 00:29:22 -0500
From: Andy Goth <andygoth AT vetec DOT com>
X-Mailer: Mozilla 4.61 [en] (Win95; I)
X-Accept-Language: en
MIME-Version: 1.0
To: DJGPP Mailing LIst <djgpp AT delorie DOT com>
Subject: Class trouble
Reply-To: djgpp AT delorie DOT com

I'm not sure whether or not this is a compiler bug, but I'm leaning that
way.  I haven't found anything wrong in my classes despite many checks.

I am writing a C++ GUI called Aguila (accent over the A--Spanish for
Eagle).  It uses Allegro (so far, just for BITMAP*'s in some classes). 
In case you don't know, a BITMAP is, well, an image, a surface to draw
on.  I have had no problems with it before, and it even works in C++
programs with classes.

So far, my project is well planned but not fully coded.  In fact, all I
have are some classes without any function implementations.  Some
classes look fairly complete, and others are nothing more than stubs.

In an attempt to test my syntax, I created a test program:

#include "../Include/Aguila.h"

int main()
{
   return 0;
}

This is to force the compiler to look through all of my classes and
check for mistakes.

C:\Prog\Djgpp\Aguila\Test>gcc -IC:/Prog/Djgpp/Include -g -c Test.cc -o
../Obj/Test.o
In file included from ../Include/Aguila.h:62,
                 from Test.cc:1:
../Include/Message/DrawMsg.h:26: parse error before `{'
../Include/Message/DrawMsg.h:31: destructors must be member functions
../Include/Message/DrawMsg.h:31: virtual outside class declaration
../Include/Message/DrawMsg.h:32: parse error before `}'
In file included from ../Include/Aguila.h:63,
                 from Test.cc:1:
../Include/Message/DoDrawMsg.h:28: base class `DrawMsg' has incomplete
type
In file included from ../Include/Aguila.h:64,
                 from Test.cc:1:
../Include/Message/ReqDrawMsg.h:31: base class `DrawMsg' has incomplete
type
In file included from ../Include/Aguila.h:65,
                 from Test.cc:1:
../Include/Message/SetBmpMsg.h:30: base class `DrawMsg' has incomplete
type

First, it has trouble compiling DrawMsg.  Then all three classes that
derive from it (DoDrawMsg, ReqDrawMsg, and SetBmpMsg--each in their own
.h file) fail since their "base class `DrawMsg' has incomplete type."

Error 1: parse error before `{'
Error 2: destructors must be member functions
Error 3: virtual outside class declaration
Error 4: parse error before `}'

// A DrawMsg is any message that deals with drawing objects.
class DrawMsg: public Message
{                                 // Error 1
public:
   // Default constructor
   DrawMsg() throw ();
   // Destructor
   virtual ~DrawMsg() throw ();   // Errors 2 and 3
};                                // Error 4

class Message doesn't seem to give me any trouble, though.

To get the source for this, look to
<http://members.xoom.com/AndyGoth/aguila.zip>.  To duplicate the exact
location that for that file on my computer, install to
C:\Prog\Djgpp\Aguila\Include.  My test file is
C:\Prog\Djgpp\Aguila\Test\Test.cc.
  ___  _   _ ____  _   _
 / _ \| \ | |  _ \\ \_/ /   .----------------------------------.
| |_| |  \| | | | |\   /    | 01001000011001010110110001101100 |
|  _  | \ \ | | | | | |     | 01101111001011000010000001110111 |
| | | | |\  | |_| | | |     | 01101111011100100110110001100100 |
|_| |_|_| \_|____/  |_|     `------[andygoth AT vetec DOT com]--------'
Floyd Code:  v1.2a s+r>d TW 0/0/ FD ? 0 DSotM 1 0 3.8% <30mar99>
ICQ#: 35256413               Homepage: <http://zap.to/andygoth/>
  That's not bad code, I'm trying to confuse would be hackers.
        Fast, small, easy to understand -- pick any two!
Is it morning already?    I hate when they fix a bug that I use.

- Raw text -


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