Linking troubles with GLFW

It has been a long time since I coded in OpenGL and I am looking to get back into it.
I’ve followed the well-laid out directions here:

I’m using MSVS 2012 for WIn10 and am using the pre-compiled GLFW libs for that version.
I have the include and lib paths setup correctly but when build I get the following error:

error LNK2019: unresolved external symbol _glfwInit referenced in function _main C:\Users\acourche\Documents\Visual Studio 2012\Projects\GLFW_Test\GLFW_Test\main.obj GLFW_Test
error LNK2019: unresolved external symbol _glfwWindowHint referenced in function _main C:\Users\acourche\Documents\Visual Studio 2012\Projects\GLFW_Test\GLFW_Test\main.obj GLFW_Test

Which indicates linking error.

I have the libs clearly included in the settings for my project:

And the lib path as well.

Is there anything else I’m missing?

Thanks!
-Adam

Hi @ajcrm125 welcome to the GLFW forums!

It looks like you are linking to both the static library version of glfw, glfw2.lib and the dll glfwdll.lib when you should only be linking to one or the other.

Note that if you want to link to the dll you need to define GLFW_DLL before including the GLFD header.

See the documentation for more information:

If you need still need help with creating a VS project, perhaps take a look at:

Using cmake you can generate a Visual Studio project with GLFW code built from source.

Thanks for the info! I tried allowing only 1 of the 2 libs mentioned but still had linker errors.

I then tried the CMake route but came up with some additional issues:

Surprised to see so many errors. Is compiling GLFW with CMake supported for Visual Studio 2012?

Thanks
-Adam

Visual Studio 2012 is pretty old, and some of your errors come from compilation issues due to C compatibility issues with older version of Visual Studio.

I recommend installing the Visual Studio 2019 Community version which is free to use.

Didn’t even know that had a community version. Thanks!