First of all, I use code blocks for windows with the latest version of mingw. I use the sfml library to start the game, but unfortunately I ran into this problem. I need to use std :: function for my state manager, but it continues to show the same error: "std :: function" is not declared. I did #include<functional>and used the linker option -std = C ++ 0x, but still no luck. The only thing that does not compile is one header:
#ifndef STATEMANAGER_HPP_INCLUDED
#define STATEMANAGER_HPP_INCLUDED
#include <vector>
#include "State.hpp"
#include <functional>
#include <SFML/Graphics.hpp>
class StateManager {
public:
StateManager();
~StateManager();
void registerState(int id, std::function< State*() > createFunc);
void setState(int id);
void update();
void draw(sf::RenderTarget &target);
private:
std::vector< std::function< State*() > > mStates;
State *mCurrentState;
};
#endif
I have no idea what the problem is. Does anyone know what's wrong here?
source
share