The basic code I use is the example from http://www.glfw.org/documentation.html
I get this output:
1>------ Build started: Project: ConsoleApplication1, Configuration: Debug Win32 ------
1> Quelle.cpp
1>Quelle.obj : error LNK2019: unresolved external symbol _glfwInit referenced in function _main
1>Quelle.obj : error LNK2019: unresolved external symbol _glfwTerminate referenced in function _main
1>Quelle.obj : error LNK2019: unresolved external symbol _glfwCreateWindow referenced in function _main
1>Quelle.obj : error LNK2019: unresolved external symbol _glfwWindowShouldClose referenced in function _main
1>Quelle.obj : error LNK2019: unresolved external symbol _glfwPollEvents referenced in function _main
1>Quelle.obj : error LNK2019: unresolved external symbol _glfwMakeContextCurrent referenced in function _main
1>Quelle.obj : error LNK2019: unresolved external symbol _glfwSwapBuffers referenced in function _main
1>C:\Users\MICHAEL\documents\visual studio 2012\Projects\ConsoleApplication1\Debug\ConsoleApplication1.exe : fatal error LNK1120: 7 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
The glfw3.h is in the VC/include directory. I've also added the glfw3.lib to the VC/lib folder and I added the glfw3.lib as an additional dependency to the linker input but I still get this errors.
Any Idea why? I've used the precompiled binaries (which support MSVC2012 and 64x) http://www.glfw.org/download.html
So when we try to assign it a value in the main function, the linker doesn't find the symbol and may result in an “unresolved external symbol” or “undefined reference”. The way to fix this error is to explicitly scope the variable using '::' outside the main before using it.
The compiler can identify when a symbol isn't declared, but it can't tell when the symbol isn't defined. It's because the definition may be in a different source file or library. If a symbol is referred to but never defined, the linker generates an unresolved external symbol error.
Ok, after very much trial and error I solved it.
That solved it for me.
This is my solution if someone is intended to use 64 bit version of GLFW:
In case of dynamic library:
Project -> Configuration -> C/C++ -> Code Generation -> Runtime Library -> Multi-threaded Debug DLL (/MDd)
In case of static library:
Project -> Configuration -> C/C++ -> Code Generation -> Runtime Library -> Multi-threaded Debug (/MTd)
Build the glfw project.
Link the following binary in your project:
glfw3.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;glfw3.lib
Also configure your project using corresponding /MDd or /MTd compiler flag and configure it to build on x64.
Build.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With