Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REDEFINES If include NULL #2561

Open
ThatOSDev opened this issue May 16, 2024 · 2 comments
Open

REDEFINES If include NULL #2561

ThatOSDev opened this issue May 16, 2024 · 2 comments
Labels
support Windows Win32 specific (not Cygwin or WSL)

Comments

@ThatOSDev
Copy link

ThatOSDev commented May 16, 2024

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.

@ThatOSDev
Copy link
Author

ThatOSDev commented May 16, 2024

Just to give a bit more info.

I have tried to undefine the 4 NULL functions to no avail.

I'm using GCC 13.2 ( MinGWx64 ) on windows.
FROM HERE: https://nuwen.net/mingw.html

Windows 10 Home 22H2

EDIT :
In GLFW 3.3.8 I could compile it without problems. No NULL files needed.

@dougbinks
Copy link
Contributor

I compile GLFW in Windows with the files added manually to my project, including the null_ files, and do not have any compile or link errors.

Could you report the errors you are seeing when you include the null_ files?

Note that when compiling GLFW manually there are a number of compile options you need to set, these are generated in glfw_config.h by the CMake script, so if needed you could run CMake to generate it for you. For windows this is just #define _GLFW_WIN32 plus #define _GLFW_BUILD_DLL if you want to build a DLL.

@dougbinks dougbinks added Windows Win32 specific (not Cygwin or WSL) support labels Jun 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support Windows Win32 specific (not Cygwin or WSL)
Projects
None yet
Development

No branches or pull requests

2 participants