I build wxWidgets and/or my application using:
Hello,
I'm one of a few people trying to pitch in and help maintain a rust-based cross-platform text expansion tool named Espanso: https://github.com/espanso/espanso
Unfortunately we've recently started seeing the below duplicate symbol error when we link our final executable.
It seems to be due to the official windows bindings now (as of 0.52 at least) including stubs for GdiPlus
Unfortunately I am a hobbyist that doesn't know c++, I do not have a Windows machine (using GitHub Actions as the builder), so debugging this has been a very slow process, I thought I would reach out to see if there are any ideas / suggestions, and I appreciate any help!
= note: wxmsw31u_core.lib(corelib_gdiplus.obj) : error LNK2005: GdipAlloc already defined in windows.0.52.0.lib(gdiplus.dll)
wxmsw31u_core.lib(corelib_gdiplus.obj) : error LNK2005: GdipCloneImage already defined in windows.0.52.0.lib(gdiplus.dll)
wxmsw31u_core.lib(corelib_gdiplus.obj) : error LNK2005: GdipCreateBitmapFromFile already defined in windows.0.52.0.lib(gdiplus.dll)
wxmsw31u_core.lib(corelib_gdiplus.obj) : error LNK2005: GdipCreateBitmapFromFileICM already defined in windows.0.52.0.lib(gdiplus.dll)
wxmsw31u_core.lib(corelib_gdiplus.obj) : error LNK2005: GdipCreateHBITMAPFromBitmap already defined in windows.0.52.0.lib(gdiplus.dll)
wxmsw31u_core.lib(corelib_gdiplus.obj) : error LNK2005: GdipDisposeImage already defined in windows.0.52.0.lib(gdiplus.dll)
wxmsw31u_core.lib(corelib_gdiplus.obj) : error LNK2005: GdipFree already defined in windows.0.52.0.lib(gdiplus.dll)
wxmsw31u_core.lib(corelib_gdiplus.obj) : error LNK2005: GdiplusShutdown already defined in windows.0.52.0.lib(gdiplus.dll)
wxmsw31u_core.lib(corelib_gdiplus.obj) : error LNK2005: GdiplusStartup already defined in windows.0.52.0.lib(gdiplus.dll)
D:\a\espanso\espanso\target\debug\deps\espanso.exe : fatal error LNK1169: one or more multiply defined symbols found
Here is the command used to build: https://github.com/espanso/espanso/blob/0b02154bb6c50c63d7ff6e4a0ff5a15f5f94dca3/espanso-modulo/build.rs#L90
nmake /f makefile.vc BUILD=release TARGET_CPU=X64
I tried adding USE_GDIPLUS=0 to the build command (hoping that it would then use the copy built with windows-sys) but it didn't change the error.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
It looks like our internal wrappers for these functions conflict with the (similar?) wrappers defined in the other library.
I see 2 possible solutions:
wx prefix, both in src/msw/gdiplus.cpp and in src/msw/graphics.cpp. This should be relatively straightforward to do.src/msw/gdiplus.cpp entirely because it shouldn't be needed any more, as GDI+ is included in all still supported Windows versions since a very long time.Unfortunately I don't have time to do this myself, but if anybody would like to make a PR doing either (preferably (2)), they would be welcome.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
The defines are guarded with wxUSE_GRAPHICS_CONTEXT, so if you don't care about wxGraphicsContext you could disable that as a quick fix.
I think with nmake you can't use build commands but you have to disable it in include/wx/msw/setup.h?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
I didn't suggest this because a lot of things require wxGraphicsContext and so it's not a good idea to disable it, generally speaking. But if you use just some specific, small subset of wx API it might indeed be a solution...
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
I'll have a look at 2. It seems all that has to be done is remove gdiplus.cpp and link with gdiplus.lib.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Thanks for the dialog and suggestions! As noted I don't do much c++ so if @MaartenBent might give this a shot I'll hold off for now. Thank you!
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Closed #24613 as completed via a0ac9a9.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()