Visual Studio C ++代码中的错误LNK2019错误

时间:2019-01-04 02:43:18

标签: c++ visual-studio compiler-errors

尝试运行一个简单的程序,该程序应使用GLFW创建一个窗口,但出现错误。

我尝试过在线查找错误的含义以及解决方法,但找不到与我的代码有关的任何内容。

Winodw.h

#include <iostream>
#include <C:\Users\ryguy\OneDrive\Desktop\glfw-3.2.1.bin.WIN32\include\GLFW\glfw3.h>
#include <string>
namespace RyhimeEngine {
    namespace Graphics {
        class Window {
        private:
            const char *m_name;
            int m_width, m_height;
            GLFWwindow* window;
        public:
            Window(const char *name, int height, int width);
            ~Window();
            int GetWidth();
            int GetHeight();
            const char* GetName();
        };
    }
}

Window.cpp

#include "Window.h"
#include <iostream>
#include <string>
namespace RyhimeEngine {
    namespace Graphics {
        Window::Window(const char *name, int height, int width) {
            m_name = name;
            m_height = height;
            m_width = width;
            glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2);
            glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
            window = glfwCreateWindow(m_width, m_height, m_name, NULL, NULL);
        }
        Window::~Window() {
            glfwDestroyWindow(window);
        }
        int Window::GetHeight() { return m_height; }
        const char* Window::GetName() { return m_name; }
        int Window::GetWidth() { return m_width; }

    }
}
int main() {
    RyhimeEngine::Graphics::Window test{ "Made in the Ryhime Engine", 640, 640 };
    return 1;
}

运行时的结果是出现LNK2019错误,提示:严重性代码说明项目文件行抑制状态 错误LNK2019无法解析的外部符号_glfwDestroyWindow在函数“ public:__thiscall RyhimeEngine :: Graphics :: Window ::〜Window(void)”中引用(?? 1Window @ Graphics @ RyhimeEngine @@ QAE @ XZ)RyhimeEngine C:\ Users \ ryguy \源\ repos \ RyhimeEngine \ RyhimeEngine \ Window.obj 1

0 个答案:

没有答案