0

I'm currently working on an implementation for a game engine. I have a Scene class and a subclass of the Scene class called MainGame. I got the error in the title, so I googled it and added a virtual destructor to both classes, as google told me to. But I still keep getting the same error. Any help would be appreciated :)

Console Output

Scene.h

class Scene
    {
    public:
        Scene(const std::string& sceneName);

        virtual ~Scene() { }

        virtual void Initialise();
        virtual void Update();
        virtual void CloseDown();

    public:
        std::string m_SceneName;
    };

Scene.cpp

    Scene::Scene(const std::string& sceneName)
    {
        m_SceneName = sceneName;
    }

MainGame.h

class MainGame : public Engine::Scene
    {
    public:
        MainGame() : Scene("Main Game Scene") {}

        virtual ~MainGame() { }

        void Initialise() override;
        void Update() override;
        void CloseDown() override;
    };
void MainGame::Initialise()
    {

    }

    void MainGame::Update()
    {

    }

    void MainGame::CloseDown()
    {

    }
Shakier
  • 7
  • 3
  • 4
    You don't have `Scene::Initialise` and the other two functions defined anywhere. That's the error. You cannot just skip them. If `Scene` is supposed to be an abstract class, make them pure virtual. – n. m. could be an AI Aug 20 '21 at 12:01
  • 1
    For most compilers, the vtable is emitted in the translation unit that defines the first *non-inline* virtual function. Declaring & defining an *inline* function won't emit the vtable at that point. (If the class is entirely inline functions, those kinds of compilers will warn that vtables will be emitted in **every** translation unit.) – Eljay Aug 20 '21 at 12:11

0 Answers0