Im trying to use shared pointer to access elements of my struct and typedef that pointer so I can pass it to other files but im constantly getting the same error
Game.h
#include <memory>
#include <string>
#include <iostream>
#include "StateMachine.h"
#include "SplashState.h"
struct GameData
{
SDL_Window* window;
SDL_Renderer* renderer;
StateMachine machine;
SDL_Event event;
};
typedef std::shared_ptr<GameData> GameDataRef;
class Game
{
public:
Game(int width, int height, std::string title);
private:
GameDataRef _data = std::make_shared<GameData>();
};
SplashState.h
#pragma once
#include "Game.h"
#include "State.h"
#include <sstream>
#include "SDL_image.h"
class SplashState : public State
{
public:
SplashState(GameDataRef data);
void Init();
void HandleInput();
void Update();
void Render();
private:
GameDataRef _data;
SDL_Texture* _texture = nullptr;
};
This is the error im getting in SplashState.h file
Error C2061 syntax error: identifier 'GameDataRef' line 11
Error C3646 '_data': unknown override specifier line 20
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int line 20