I’ve recently taken an interest in OpenGL rendering, but I can’t for the life of me seem to get the GLFW libraries to work. I’ve followed instructions on installing the pre-compiled libraries from videos such as
down to a tee, and spent countless hours scrutinizing over the details and trying to understand the happenings of compilers and linkers, but alas, I couldn’t fix my problem, so here I am seeking help. What am I doing wrong?
I downloaded the 32-bit windows binaries.
I moved the “include” and “lib-mingw” folders into my project’s folder (Console Application).
Under “Project > Build Options > Search Directories > Compiler” I added the “include” directory as a relative path.
Under “Project > Build Options > Search Directories > Linker” I added the “lib-mingw” directory as a relative path.
Under “Project > Build Options > Linker Settings” I added “glfw3”, “gdi32” and “opengl32” to the Link Libraries
Then when I try compiling the project with the sample code from the GLFW documentation, I receive the errors:
cannot find -lglfw3
Id returned 1 exit status
I find this more confusing yet, since there isn’t a “gdi32” nor “opengl32” in the “lib-mingw” folder, and there IS a glfw3 library file in it, yet that is the one it doesn’t manage to find. I’ve tried adding only the glfw3 library file in the lib-mingw folder to the “Link-Libraries” as a non-relative path, but that didn’t work either. Any ideas what I’ve done wrong here?
After taking a look at the build log, it seems it’s skipping over all of the libglfw.a files because it thinks they’re incompatible? https://pastebin.com/fVA4EkLW
And if I enter the direct path to the libglfw.a file non-relatively, it just doesn’t manage to read it. https://pastebin.com/7kY4UzLV
You are using a compiler that produces 64-bit binaries (x86_64-w64-mingw32-g++.exe) so you need to use 64-bit GLFW library files. These are in lib-mingw-w64 in the 64-bit binary archive.
What would the new linked libraries be for the 64-bit binaries instead of gdi32 and opengl32? I would have assumed gdi64 and opengl64, but apparently, they can’t be found.
Confusingly enough, the 64-bit versions of gdi32 and opengl32 don’t have different names. It’s similar to why Windows’ System32 folder contains 64-bit libraries, and SysWoW64 contains 32-bit…