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

Backends: SDL2: Replace non-portable forward declaration with the actual include #8095

Closed
wants to merge 1 commit into from

Conversation

sev-
Copy link
Contributor

@sev- sev- commented Oct 23, 2024

In ScummVM project, we compile imgui on number of platforms.

On some platforms, the current forward declaration causes error on compilation with symbol redefinition:

In file included from backends/imgui/backends/imgui_impl_sdl2.cpp:1155:
/usr/include/SDL2/SDL_vulkan.h:204:30: error: conflicting declaration of ‘void SDL_Vulkan_GetDrawableSize(SDL_Window, int, int)’ with ‘C’ linkage
 extern DECLSPEC void SDLCALL SDL_Vulkan_GetDrawableSize(SDL_Window window,
                              ^~~~~~
backends/imgui/backends/imgui_impl_sdl2.cpp:132:30: note: previous declaration with ‘C++’ linkage
 extern DECLSPEC void SDLCALL SDL_Vulkan_GetDrawableSize(SDL_Window* window, int* w, int* h);
                              ^~~~~~
/usr/include/SDL2/SDL_vulkan.h:204:30: warning: redundant redeclaration of ‘void SDL_Vulkan_GetDrawableSize(SDL_Window, int, int)’ in same scope [-Wredundant-decls]
 extern DECLSPEC void SDLCALL SDL_Vulkan_GetDrawableSize(SDL_Window window,
                              ^~~~~~
backends/imgui/backends/imgui_impl_sdl2.cpp:132:30: note: previous declaration of ‘void SDL_Vulkan_GetDrawableSize(SDL_Window, int, int)’
 extern DECLSPEC void SDLCALL SDL_Vulkan_GetDrawableSize(SDL_Window window, int* w, int* h);

This patch replaces the declaration with a simple include, which makes sure there is no duplicate.

Thanks for your work on ImGui.

ocornut pushed a commit that referenced this pull request Oct 24, 2024
@ocornut
Copy link
Owner

ocornut commented Oct 24, 2024

Thank you, this is merged as a855bd8 !
I am not sure I know why #7967 didn't do this in the first place?

@ocornut ocornut closed this Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants