Setting Up GLFW

So Added all the additional libraries but still get error in the output:

1>------ Build started: Project: Learning1, Configuration: Debug Win32 ------
1>Application.obj : error LNK2019: unresolved external symbol _glfwInit referenced in function _main
1>Application.obj : error LNK2019: unresolved external symbol _glfwTerminate referenced in function _main
1>Application.obj : error LNK2019: unresolved external symbol _glfwCreateWindow referenced in function _main
1>Application.obj : error LNK2019: unresolved external symbol _glfwWindowShouldClose referenced in function _main
1>Application.obj : error LNK2019: unresolved external symbol _glfwPollEvents referenced in function _main
1>Application.obj : error LNK2019: unresolved external symbol _glfwMakeContextCurrent referenced in function _main
1>Application.obj : error LNK2019: unresolved external symbol _glfwSwapBuffers referenced in function _main
1>N:\OpenGL\Learning\Learning1\Dependencies\GLFW\lib-vc2022\glfw3.lib : warning LNK4272: library machine type 'x64' conflicts with target machine type 'x86'
1>N:\OpenGL\Learning\Learning1\Debug\Learning1.exe : fatal error LNK1120: 7 unresolved externals

warning LNK4272: library machine type 'x64' conflicts with target machine type 'x86'

This means that glfw3.lib you’re using is built for 64-bit code. But the code you are linking is built as 32-bit code - the Win32 selection on Platform drop-down means you’re looking at 32-bit build. Either switch to x64 platform to build 64-bit code. Or get 32-bit glfw3.lib file if you want to build 32-bit executable.

Thank you so much, I accidently downloaded the 64-bit code instead of the 32-bit. Thanks once again :smiley:

Isn’t it possible to build GLFW in 32 bit? I change the compiler in the visual studio setting, it doesn’t build in x86. By default, there is no x86 drop down menu in visual studio.

Am I missing something?

I have cmake 3.27.6.

Hi @jokoon,

Welcome to the GLFW forum.

CMake has recently switched to defaulting the Visual Studio generator to 64bit. To select 32bit you need to specify the target platform, for example with -A Win32.

See:
https://cmake.org/cmake/help/latest/generator/Visual%20Studio%2017%202022.html