引用GLFW是否会导致编译报错问题

问题遇到的现象和发生背景

使用GLFW引用项目时Sandbox编译报错报错

问题相关代码,请勿粘贴截图

Sandbox.cpp

#include "bkpch.h"
#include "Application.h"

#include "Black/Events/ApplicationEvent.h"
#include "Black/Log.h"

namespace Black {
    Application::Application() {
        m_Window = std::unique_ptr(Window::Create());
    }
    Application::~Application() {

    }

    void Application::Run() {
        while (m_Running) {
            m_Window->OnUpdate();
        }
    }
}


Application.h

#pragma once

#include "Core.h"
#include "Events/Event.h"
#include "Window.h"

namespace Black {

    class BLACK_API Application
    {
    public:
        Application();
        virtual ~Application();

        void Run();
    private:
        std::unique_ptr m_Window;
        bool m_Running = true;
    };
    //定义客户端
    Application* CreateApplication();
}



Application.cpp

#include "bkpch.h"
#include "Application.h"

#include "Black/Events/ApplicationEvent.h"
#include "Black/Log.h"

namespace Black {
    Application::Application() {
        m_Window = std::unique_ptr(Window::Create());
    }
    Application::~Application() {

    }

    void Application::Run() {
        while (m_Running) {
            m_Window->OnUpdate();
        }
    }
}



#include 

class Sandbox :public Black::Application {
public:
    Sandbox() {

    }
    ~Sandbox() {

    }
};

Black::Application* Black::CreateApplication() {
    return new Sandbox();
}

EntryPoint.h

 #pragma once

#ifdef BK_PLATFORM_WINDOWS

extern Black::Application* Black::CreateApplication();

int main(int argc, char** argv) {
    BK_INIT;
    BK_CORE_WARN("Initialized Log..........");
    BK_WARN("Initialized System.........");
    int a = 89;

    BK_INFO("Hello! Var={0}", a);
    auto app = Black::CreateApplication();
    app->Run();
    delete app;
}
#endif // BK_PLATFORM_WINDOWS



Windows.h


#pragma once

#include "bkpch.h"

#include "Black/Core.h"
#include "Black/Events/Event.h"

namespace Black {
    struct WindowProps
    {
        std::string Title;
        unsigned int Width;
        unsigned int Height;

        WindowProps(const std::string& title = "Black Engine",
            unsigned int width = 1280,
            unsigned int height = 720)
            : Title(title), Width(width), Height(height)
        {
        }
    };

    class BLACK_API Window {
    public:
        using EventCallbackFn = std::function<void(Event&)>;

        virtual ~Window() {}

        virtual void OnUpdate() = 0;

        virtual unsigned int GetWidth() const = 0;
        virtual unsigned int GetHeight() const = 0;

        virtual void SetEventCallback(const EventCallbackFn& callback) = 0;
        virtual void SetVSync(bool enabled) = 0;
        virtual bool IsVSync() const = 0;

        static Window* Create(const WindowProps& props = WindowProps());

    };
}

WindowsWindow.h

#pragma once

#include "Black/Window.h"

#include 

namespace Black {
    class WindowsWindow : public Window {
    public:
        WindowsWindow(const WindowProps& props);
        virtual ~WindowsWindow();

        void OnUpdate() override;
        
        inline unsigned int GetWidth() const override { return m_Data.Width; }
        inline unsigned int GetHeight() const override { return m_Data.Height; }

        inline void SetEventCallback(const EventCallbackFn& callback) override { m_Data.EventCallback = callback; }
        void SetVSync(bool enabled) override;
        bool IsVSync() const override;

    private:
        virtual void Init(const WindowProps& props);
        virtual void Shutdow();

    private:
        GLFWwindow* m_Window;

        struct WindowData
        {
            std::string Title;
            unsigned int Width, Height;
            bool VSync;

            EventCallbackFn EventCallback;
        };

        WindowData m_Data;
    };
}


WindowsWindow.cpp

#include "bkpch.h"
#include "WindowsWindow.h"

namespace Black {
    static bool s_GLFWInitialized = false;

    Window* Window::Create(const WindowProps& props) {
        return new WindowsWindow(props);
    }

    WindowsWindow::WindowsWindow(const WindowProps& props) {
        Init(props);
    }

    WindowsWindow::~WindowsWindow() {
        Shutdow();
    }

    void WindowsWindow::Init(const WindowProps& props) {
        m_Data.Title = props.Title;
        m_Data.Width = props.Width;
        m_Data.Height = props.Height;

        BK_CORE_INFO("Creating window {0} ({1}, {2})", props.Title, props.Width, props.Height);

        if (!s_GLFWInitialized) {
            int success = glfwInit();
            BK_CORE_ASSERT(success, "Could not intialize GLFW!");
            s_GLFWInitialized = true;
        }

        m_Window = glfwCreateWindow((int)props.Width, (int)props.Height, m_Data.Title.c_str(), nullptr, nullptr);
        glfwMakeContextCurrent(m_Window);
        glfwSetWindowUserPointer(m_Window, &m_Data);
        SetVSync(true);

    }

    void WindowsWindow::Shutdow() {
        glfwDestroyWindow(m_Window);
    }

    void WindowsWindow::OnUpdate() {
        glfwPollEvents();
        glfwSwapBuffers(m_Window);

    }

    void WindowsWindow::SetVSync(bool enabled) {
        if (enabled) glfwSwapInterval(1);
        else glfwSwapInterval(0);

        m_Data.VSync = enabled;
    }

    bool WindowsWindow::IsVSync() const {
        return m_Data.VSync;
    }
}

运行结果及报错内容

img

img

我想要达到的结果

修复Sandbox编译报错