For some reason I am getting this error that wasn't showing up before. The error is stating that object of abstract type InitializeState is not allowed. However, i wasn't having this issue before, and I didn't really make any changes to either files. Here is the header file:
#ifndef InitializeState_h
#define InitializeState_h
#include "State.h"
#include "SFML/Graphics.hpp"
class InitializeState : public State{
public:
void Load(sf::RenderWindow*);
//void Load();
void Handling(SEngine* gameEng);
void Paint(SEngine* gameEng);
void Update(SEngine* gameEng);
void TidyUp();
void Halt();
void Continue();
static InitializeState* Initialize(){
return &gameStart;
}
protected:
InitializeState() {}
private:
static InitializeState gameStart;
};
#endif
Here is the c++ file where the error is occurring:
#include "InitializeState.h"
#include "State.h"
#include "SEngine.h"
#include <SFML/Graphics.hpp>
InitializeState InitializeState::gameStart;
void InitializeState::Load(sf::RenderWindow* window){
rwindow = window;
rwindow->create(sf::VideoMode(200,200), "Working");
};
void InitializeState::Handling(SEngine* gameEng){
};
void InitializeState::Paint(SEngine* gameEng){
};
void InitializeState::Update(SEngine* gameEng){
};
void InitializeState::Continue(){
};
void InitializeState::Halt(){
};
The fifth line of code, InitializeState InitializeState::gameStart;, is where the error is occurring.
Here is the error window:
1>------ Build started: Project: 2D Game, Configuration: Debug Win32 ------
1> SEngine.cpp
1>c:\users\brandon\documents\visual studio 2010\projects\2d game\2d game\sengine.cpp(26): error C2660: 'State::Handling' : function does not take 1 arguments
1> Main.cpp
1> InitializeState.cpp
1>c:\users\brandon\documents\visual studio 2010\projects\2d game\2d game\initializestate.cpp(9): error C2259: 'InitializeState' : cannot instantiate abstract class
1> due to following members:
1> 'void State::Handling(void)' : is abstract
1> c:\users\brandon\documents\visual studio 2010\projects\2d game\2d game\state.h(14) : see declaration of 'State::Handling'
1> 'void State::Paint(void)' : is abstract
1> c:\users\brandon\documents\visual studio 2010\projects\2d game\2d game\state.h(15) : see declaration of 'State::Paint'
1> 'void State::Update(void)' : is abstract
1> c:\users\brandon\documents\visual studio 2010\projects\2d game\2d game\state.h(16) : see declaration of 'State::Update'
1> Generating Code...
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========