I have a problem with some warnings when I compile my code. This is the file where the warnings are coming from:
#include <memory>
#include <string>
#include <SFML/Graphics.hpp>
#include "StateMachine.hpp"
#include "AssetManager.hpp"
#include "InputManager.hpp"
#ifndef GAME_HPP
#define GAME_HPP
struct GameData {
StateMachine machine;
sf::RenderWindow window;
AssetManager assets;
InputManager input;
};
typedef std::shared_ptr<GameData> GameDataRef;
class Game {
public:
Game(int width, int height, std::string title);
private:
const float dt = 1.0f / 3600.0f;
sf::Clock _clock;
GameDataRef _data = std::make_shared<GameData>();
void Run();
};
#endif
From the terminal the warnings are stated as this:
Game.hpp:11:8: warning: ?GameData::input? should be initialized in the member initialization list [-Weffc++]!
The same warning goes for window, machine and assets aswell. I don't understand how I should initialize them as they already are initialized in the struct? Would someone be kind and explain a way to handle this?