#2561·glfw

Compilation issues with single file builds (Unity Builds)

Author: ThatOSDevCreated May 16, 2024Updated Aug 13, 2026
LabelsenhancementWindowssupport

If I include these files....

#include "../external/glfw-3.3.8/src/osmesa_context.c" #include "../external/glfw-3.3.8/src/platform.c" // Added for version GLFW 3.4, wasn't needed in 3.3.8 / 3.3.10 #include "../external/glfw-3.3.8/src/context.c" #include "../external/glfw-3.3.8/src/egl_context.c" #include "../external/glfw-3.3.8/src/init.c" #include "../external/glfw-3.3.8/src/input.c" #include "../external/glfw-3.3.8/src/monitor.c" #include "../external/glfw-3.3.8/src/vulkan.c" #include "../external/glfw-3.3.8/src/window.c" #include "../external/glfw-3.3.8/src/win32_init.c" #include "../external/glfw-3.3.8/src/win32_joystick.c" #include "../external/glfw-3.3.8/src/win32_module.c" // Added for version GLFW 3.4, wasn't needed in 3.3.8 / 3.3.10 #include "../external/glfw-3.3.8/src/win32_thread.c" #include "../external/glfw-3.3.8/src/win32_time.c" #include "../external/glfw-3.3.8/src/win32_window.c" #include "../external/glfw-3.3.8/src/win32_monitor.c" #include "../external/glfw-3.3.8/src/wgl_context.c"

I get an undefined reference to _glfwConnectNull

So I include the NULL files

#include "../external/glfw-3.4/src/null_init.c" #include "../external/glfw-3.4/src/null_joystick.c" #include "../external/glfw-3.4/src/null_monitor.c" #include "../external/glfw-3.4/src/null_window.c"

But as soon as I include those, then I get 4 functions with the same name, redefined. I only want to use _GLFW_WIN32 for windows platforms. But the code is forcing me to add NULL files when they are not needed.

Is there a way around this ?

EDIT: Only way around it I have found so far is just to simply comment those four functions out in the null_windows.c file. I'm hoping a more official way is found.