Question

Long Story short, OpenGL beginner/dabbler, Using GLFW for self study purpose.

I downloaded GLFW precompiled binaries from here and I followed this tutorial (I know its for VS2010 specific but still) I have read numerous questions on linker errors for VS2012 + GLFW 3.x set up. None of them solved my problem. Here is what I have in my code so far.

#define GLFW_DLL
#include <glfw3.h>

#pragma comment(lib,"glfw3.lib")
#pragma comment(lib,"glfw3dll.lib")
#pragma comment(lib,"opengl32.lib")


int main(int argc,char** argv)
{
    GLFWwindow* window;

    /* 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);

    /* Loop until the user closes the window */
    while (!glfwWindowShouldClose(window))
    {
        /* Render here */

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

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

    glfwTerminate();
    return 0;
}

Here is what I have in my VC include directory. enter image description here VC lib directory enter image description here VC linker input options enter image description here System32 DLL enter image description here

Compilation is successful. However, I get enter image description here

Why, what is wrong with this set up?

UPDATE:: I tried placing all the files (dlls, lib and headers) in the project folder, still no results, I still get the same error message.

Was it helpful?

Solution

The easiest solution would be to use the static library rather than the dll, thus removing the need for the dll.

To do this you need to remove the define for GLFW_DLL so you file reads:

#include <glfw3.h>

main() // code follows

And you need to remove the glfw3dll.lib from the additional dependencies but leave glfw3.lib and opengl32.lib.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top