BossOfTheGame
February 6th, 2008, 11:54 PM
Ok, I have this program with a few different files, but I'm going to focus on the ones that are in this problem.
EventReciever.h/.c, LoadScreen.h/.c, CGUI.h/.c, and CommonInclude.h
The header files are in the format
#ifndef <filename>_H
#define <filename>_H
// All the definitions of structures, classes, and functions
#endif <filename>_H
obviously just replace <filename> with COMMONINCLUDE or something else.
Everything except LoadScreen includes CommonInclude.h
EventReciver defines a structure ToDoOnEvent and a class EventReciver
CGUI includes EventReciver.h and defines a class called CGUI
LoadScreen includes CGUI.h and defines a class called FrameLoader derived from CGUI
Now, like this there is no problem, however I want to add a pointer to a CGUI to the structure ToDoOnEvent, but when I include CGUI.h in EventReciver.h I get an error
error C2143: syntax error: missing ';' before '*'
error C4430: missing type specifier - int assumed. Note C++ do...
error C4430: missing type specifier - int assumed. Note C++ do...
all of these errors bring me to a line in CGUI.h in the class definition
class CGUI
{
public:
//variables
IrrlichtDevice* m_Device;
EventReciver* m_EventReciver; <-THIS IS THE LINE WHERE IT GIVES ME THE ERROR
s32 m_ExitCode;
//functions
void Exit(s32 exitCode);
//constructor
//IrrlichtGUI();
//destructor
~CGUI();
};
}
NOTE: s32 is typedef as an int
I'm a mediocre C++ programmer, and I'm stumped on this one.
while I'm at it I might as well ask a few more generic C++ questions:
1. How do you call a parent class destructor/constructor in the child class destructor/constructor? Is it done automatically?
2. When you delete an array thats contents have been allocated with new will it free all the memory if you go: delete []array; delete array;?
3. Is it possible to get a pointer to a function of a class and call that function with the pointer?
Thanks for any help given.
EventReciever.h/.c, LoadScreen.h/.c, CGUI.h/.c, and CommonInclude.h
The header files are in the format
#ifndef <filename>_H
#define <filename>_H
// All the definitions of structures, classes, and functions
#endif <filename>_H
obviously just replace <filename> with COMMONINCLUDE or something else.
Everything except LoadScreen includes CommonInclude.h
EventReciver defines a structure ToDoOnEvent and a class EventReciver
CGUI includes EventReciver.h and defines a class called CGUI
LoadScreen includes CGUI.h and defines a class called FrameLoader derived from CGUI
Now, like this there is no problem, however I want to add a pointer to a CGUI to the structure ToDoOnEvent, but when I include CGUI.h in EventReciver.h I get an error
error C2143: syntax error: missing ';' before '*'
error C4430: missing type specifier - int assumed. Note C++ do...
error C4430: missing type specifier - int assumed. Note C++ do...
all of these errors bring me to a line in CGUI.h in the class definition
class CGUI
{
public:
//variables
IrrlichtDevice* m_Device;
EventReciver* m_EventReciver; <-THIS IS THE LINE WHERE IT GIVES ME THE ERROR
s32 m_ExitCode;
//functions
void Exit(s32 exitCode);
//constructor
//IrrlichtGUI();
//destructor
~CGUI();
};
}
NOTE: s32 is typedef as an int
I'm a mediocre C++ programmer, and I'm stumped on this one.
while I'm at it I might as well ask a few more generic C++ questions:
1. How do you call a parent class destructor/constructor in the child class destructor/constructor? Is it done automatically?
2. When you delete an array thats contents have been allocated with new will it free all the memory if you go: delete []array; delete array;?
3. Is it possible to get a pointer to a function of a class and call that function with the pointer?
Thanks for any help given.