I am getting these errors in my code, they are all related to one static member in my Game class.
Game.obj : error LNK2019: unresolved external symbol "public: class std::shared_ptr<class MainMenuScene> __thiscall SceneManager::AddScene<class MainMenuScene>(void)" (??$AddScene@VMainMenuScene@@@SceneManager@@QAE?AV?$shared_ptr@VMainMenuScene@@@std@@XZ) referenced in function "public: void __thiscall Game::init(char const *,int,int,bool)" (?init@Game@@QAEXPBDHH_N@Z)
Game.obj : error LNK2019: unresolved external symbol "public: class std::shared_ptr<class GameSelectScene> __thiscall SceneManager::AddScene<class GameSelectScene>(void)" (??$AddScene@VGameSelectScene@@@SceneManager@@QAE?AV?$shared_ptr@VGameSelectScene@@@std@@XZ) referenced in function "public: void __thiscall Game::init(char const *,int,int,bool)" (?init@Game@@QAEXPBDHH_N@Z)
Game.obj : error LNK2019: unresolved external symbol "public: class std::shared_ptr<class MainMenuScene> __thiscall SceneManager::ChangeScene<class MainMenuScene>(void)" (??$ChangeScene@VMainMenuScene@@@SceneManager@@QAE?AV?$shared_ptr@VMainMenuScene@@@std@@XZ) referenced in function "public: void __thiscall Game::init(char const *,int,int,bool)" (?init@Game@@QAEXPBDHH_N@Z)
In my game.h I have:
#pragma once
class SceneManager; 
using namespace std;
class Game {
public:
    Game();
    ~Game();
    void init(const char* title, int width, int height, bool fullscreen);
    void handleEvents();
    void update();
    void render();
    void clean();
    bool isRunning() { return running; }
    static SDL_Renderer * renderer; 
    static SceneManager * sceneManager; 
};
The errors are happening in my game.cpp file in the init() method and my game.cpp looks like:
#include "Game.h"
#include "SceneManager.h"
#include "GameSelectScene.h"
#include "MainMenuScene.h" 
SceneManager * Game::sceneManager = new SceneManager();
Game::Game() {}
Game::~Game() {}
void Game::init(const char* title, int width, int height, bool fullscreen) {
    // I do some stuff up here
    // Here is where I think errors are happening.
    sceneManager->AddScene<MainMenuScene>();
    sceneManager->AddScene<GameSelectScene>();
    sceneManager->ChangeScene<MainMenuScene>();
}
My GameSelectScene.h and MainMenuScene.h are both subclasses of my Scene.h and my SceneManager is where the AddScene and ChangeScene methods are defined
My SceneManager.h: #pragma once
#include "Game.h"
#include "Scene.h"
#include <map>
#include <string>
#include <typeindex>
using namespace std;
class SceneManager {
public:
    SceneManager();
    ~SceneManager();
    void init();
    void update();
    void render();
    template <typename T> std::shared_ptr<T> ChangeScene();
    template <typename T> std::shared_ptr<T> AddScene();
private:
    std::map<type_index, std::shared_ptr<Scene>> scenes;
    std::shared_ptr<Scene> currentScene;
}; 
SceneManager.cpp:
#include "SceneManager.h"
SceneManager::SceneManager() {}
SceneManager::~SceneManager() {}
// I define the init() update() and render()
template <typename T> std::shared_ptr<T> SceneManager::ChangeScene() {
    type_index index(typeid(T));
    currentScene = scenes[index];
    return static_pointer_cast<T>(scenes[index]);
}
template <typename T> std::shared_ptr<T> SceneManager::AddScene() {
    T scene = new T();    
    scenes[std::type_index(typeid(*scene))] = scene;
    return scene;
}
If I remove my AddScene and ChangeScene method calls in the game.cpp file everything compiles correctly and the update, init and render methods defined in the SceneManager run perfectly. I have been researching this issue and walked through all the problems described in MSDN LNK2019 Error
 
    