Glfw and Visual Studio Community 2015

barfoobar wrote on Friday, August 07, 2015:

Hi,

I downloaded the source package and used the cmake gui to generate the build files (I used the default configuration). Then I opened the resulting files in Visual Studio Community 2015 and compiled it (no errors).

Then I included the generated files from the include folder(glfw3.h and glfw3native.h) into my project and added the library files (glfw3.lib and glfw3.dll). (Additional dependencies glfw3.lib, opengl32.lib, glu32.lib, kernel32.lib, user32.lib). Then I copied the.dll file into my system32 folder and into my build folder

I include in my source code the glfw3.h file.

Unfortunately I am getting errors when I build my source code:

Error LNK2019 unresolved external symbol __imp__glfwSwapBuffers referenced in function _main BonbonGame F:\Programme\TestGame\TestGame\TestGame\TestGame.obj 1
Error LNK1120 7 unresolved externals BonbonGame F:\Programme\TestGame\TestGame\Debug\BonbonGame.exe 1
Error LNK2019 unresolved external symbol __imp__glfwInit referenced in function _main BonbonGame F:\Programme\TestGame\TestGame\TestGame\TestGame.obj 1
Error LNK2019 unresolved external symbol __imp__glfwTerminate referenced in function _main BonbonGame F:\Programme\TestGame\TestGame\TestGame\TestGame.obj 1
Error LNK2019 unresolved external symbol __imp__glfwCreateWindow referenced in function _main BonbonGame F:\Programme\TestGame\TestGame\TestGame\TestGame.obj 1
Error LNK2019 unresolved external symbol __imp__glfwWindowShouldClose referenced in function _main BonbonGame F:\Programme\TestGame\TestGame\TestGame\TestGame.obj 1
Error LNK2019 unresolved external symbol __imp__glfwPollEvents referenced in function _main BonbonGame F:\Programme\TestGame\TestGame\TestGame\TestGame.obj 1
Error LNK2019 unresolved external symbol __imp__glfwMakeContextCurrent referenced in function _main BonbonGame F:\Programme\TestGame\TestGame\TestGame\TestGame.obj 1

Did I forget to configure something Visual Studio?

Thanks,

dougbinks wrote on Friday, August 07, 2015:

See http://www.glfw.org/docs/latest/build.html#build_link_win32

Normally you link to the glfw3.lib or the glfw3dll.lib with GLFW_DLL defined (and then put the dll somewhere it an be found such as the same folder as the exe, or a system folder) - though I’m not sure what the source download cmake builds with default configuration exactly.