Mail Archives: djgpp/1998/05/10/12:14:11
I am having trouble getting classes set up in DJGPP. The problem is that
gpp gives me the error: "palette.c:9: return type specification for
constructor invalid" when I try to compile. If I comment out the
constructor, then it gives me the same type of error for the destructor.
Also, if I try to declare DCColor in palette.h and implement it in
palette.c, then I get these errors on compile:
In file included from palette.c:5:
palette.h:10: field `paletteArray' has incomplete type
palette.c:12: warning: multiple types in one declaration
palette.c: In method `DCPaletteType::DCPaletteType()':
palette.c:24: confused by earlier errors, bailing out
Anyone have any idea what I am doing wrong?
Here are the files that are giving me problems when I compile...
/* palette.h */
#ifndef DCPALETTETYPE
#define DCPALETTETYPE
typedef struct DCColor
{
unsigned char red;
unsigned char green;
unsigned char blue;
};
class DCPaletteType
{
private:
char * filename;
DCColor paletteArray[256];
public:
DCPaletteType();
~DCPaletteType();
int Load(char * path, char * filename);
int Save(char * path, char * filename);
int Import(char * path, char * filename, int format);
int Export(char * path, char * filename, int format);
}
#endif
/* palette.c */
#include <stdio.h>
#include <alloc.h>
#include <process.h>
#include <string.h>
#include "palette.h"
DCPaletteType::DCPaletteType()
{
int counter;
for (counter=0; counter<256; counter++)
{
paletteArray[counter].red=0;
paletteArray[counter].green=0;
paletteArray[counter].blue=0;
}
}
DCPaletteType::~DCPaletteType()
{
}
int DCPaletteType::Load(char * path, char * filename)
{
return 0;
}
int DCPaletteType::Save(char * path, char * filename)
{
return 0;
}
int DCPaletteType::Import(char * path, char * filename, int format)
{
return 0;
}
int DCPaletteType::Export(char * path, char * filename, int format)
{
return 0;
}
Thanks!
Greg
- Raw text -