Compiler Tells me all the time about undefined reference to ChangeStateMachine() constructor. And I'm stuck at it for about an hour just staring at code and can't find any fail. Please help me find where i make mistake.
So thats my class file:
#pragma once
#include <iostream>
class ChangeStateMachine{
private:
int state;
int newState;
public:
ChangeStateMachine();
ChangeStateMachine(int state);
void ChangeState(int newState);
enum STATES{GAME, MENU, GAME_OVER};
};
Here I define ChangeStateMachine constructors:
#include "main.h"
ChangeStateMachine::ChangeStateMachine()
{
state = MENU;
newState = -1;
}
ChangeStateMachine::ChangeStateMachine(int state)
{
ChangeStateMachine::state = state;
newState = -1;
}
[...]
And call it in the main file:
#include <iostream>
#include "main.h"
//GLOBALS
ChangeStateMachine *SetState;
int main(void)
{
//PROJECT INIT
SetState = new ChangeStateMachine();
[...]
The exact compiler error is:
../precompiled/main.cxx:13: undefined reference to `ChangeStateMachine::ChangeStateMachine()'
Thanks a lot for any response, Siery.