函数main中引用的未解析的外部符号__imp_glewInit

时间:2019-07-09 17:52:34

标签: c++ opengl

所以我的链接器出现错误,并且我一直在试图解决这个问题。但是我失败了,任何人都可以帮我这是正在出现的错误 函数main中引用的未解析的外部符号__imp_glewInit

glew32.dll添加了


#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <iostream>

using namespace std;
int main(void)
{
    GLFWwindow* window;
    if (glewInit() != GLEW_OK) {
        cout << "error" << endl;

    }
    /* Initialize the library */
    if (!glfwInit()) {
        return -1;
    }

    /* Create a windowed mode window and its OpenGL context */
    window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL);
    if (!window)
    {
        glfwTerminate();
        return -1;
    }

    /* Make the window's context current */
    glfwMakeContextCurrent(window);
    cout << glGetString(GL_VERSION) << endl;
    /* Loop until the user closes the window */
    while (!glfwWindowShouldClose(window))
    {
        /* Render here */
        glClear(GL_COLOR_BUFFER_BIT);
        glBegin(GL_TRIANGLES);
        glVertex2f(0.1f, -0.1f);
        glVertex2f(0.5f, -0.5f);
        glVertex2f(-0.0f, -0.0f);

        glEnd();

        /* Swap front and back buffers */
        glfwSwapBuffers(window);

        /* Poll for and process events */
        glfwPollEvents();
    }

    glfwTerminate();
    return 0;
}

1 个答案:

答案 0 :(得分:0)

嘿,我发现了这个问题,问题出在定义GLEW_STATIC时,我忘了加一个;在预处理器部分