GLFW 2.7.6 Fails to Initialize on Windows 11

Hello guys!

I know this is a very old version, but I bought the book OpenGL Superbible 6th edition (which was available in my region) and it uses GLFW 2.7.6.

I had many compilation problems, but I managed to solve all of them by manually creating a project ecosystem using Premake5.

The project seems stable on Linux for now, but in Windows, even though the compilation succeeds for both GLFW and the main project, GLFW fails to initialize…

This is the repo of the project

The problem might be related to the configuration I’ve done in this premake script, so if you have some time could you check if I’m missing a build option or macro definition inside the windows filter?

I’ve tried setting the macro _GLFW_WIN32, but it does not seem to make any difference, probably it was not used in the 2.7.6 edition.

Thank you!

Hi @babaliaris, welcome to the GLFW forum,

I just tested a repo of mine which uses GLFW 2.7.6 that I haven’t yet converted to 3:

This works fine for me on Windows 11, so you could take a look at it to see what you need to change.

However I’d still recommend moving to GLFW 3 if you can.

A good initial starting point might be this:

1 Like

Thank you very much!

I found the problems:
I didn’t include `“lib/win32/win32_dllmain.c”, and I had to add the following compiler flags for win32:
“-D_GLFW_NO_DLOAD_GDI32”,
“-D_GLFW_NO_DLOAD_WINMM”,
“-D_MBCS”

Now it works great!!!

Thank you for your links! I compared my build configuration with yours in the RCC++ project.
This is how I found the problem!!!