Duplicate symbol: vtable for wxThreadHelperThread

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
xemuth
In need of some credit
In need of some credit
Posts: 5
Joined: Mon Jan 18, 2021 3:35 pm

Duplicate symbol: vtable for wxThreadHelperThread

Post by xemuth »

Hello, I'm starting with wxWidgets, I have compiled it using Mingw64 (MSYS2) using :

Code: Select all

 ./configure --with-opengl --disable-shared --enable-unicode --disable-debug
then

Code: Select all

make
make install
it compiled and gave me multiple .a file. So far so good, I have just copy paste the WxWidget Hello World exemple (this one)

I have added all libs to my linking options

Code: Select all

wx_mswu_aui-3.0
wx_mswu_core-3.0
wx_mswu_gl-3.0
wx_mswu_html-3.0
wx_mswu_media-3.0
wx_mswu_propgrid-3.0
wx_mswu_qa-3.0
wx_mswu_ribbon-3.0
wx_mswu_richtext-3.0
wx_mswu_stc-3.0
wx_mswu_webview-3.0
wx_mswu_xrc-3.0
wxjpeg-3.0
wxpng-3.0
wxregexu-3.0
wxscintilla-3.0
wxtiff-3.0
wx_baseu_net-3.0
wx_baseu_xml-3.0
wx_baseu-3.0
wx_mswu_adv-3.0
resulting in :

Code: Select all

 (): lld-link: error: duplicate symbol: vtable for wxThreadHelperThread
 (): >>> defined at libwx_mswu_core-3.0.a(corelib_event.o)
 ...
 (): lld-link: error: duplicate symbol: typeinfo name for wxTrackable
 (): >>> defined at libwx_mswu_core-3.0.a(corelib_event.o)
 ...
Can someone help me ?

Best regard, Thanks in advance
Xemuth
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Duplicate symbol: vtable for wxThreadHelperThread

Post by ONEEYEMAN »

Hi,
Did you try building minimal sample provided?

Thank you.
xemuth
In need of some credit
In need of some credit
Posts: 5
Joined: Mon Jan 18, 2021 3:35 pm

Re: Duplicate symbol: vtable for wxThreadHelperThread

Post by xemuth »

Hello ONEEYMAN,

I guess you speak about : https://github.com/wxWidgets/wxWidgets/ ... inimal.cpp

Yes I tried and same result : duplicate symbol vtable for wxThreadHelperThread.

Do you think I compiled wrongly my WxWidget ?
User avatar
doublemax
Moderator
Moderator
Posts: 19115
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Duplicate symbol: vtable for wxThreadHelperThread

Post by doublemax »

xemuth wrote: Tue Jan 19, 2021 9:37 am I guess you speak about : https://github.com/wxWidgets/wxWidgets/ ... minimal.cp
How exactly did you build that? Using the provided makefiles?

Do you have to use MSYS? This method is rarely used under Windows.

The "standard" way of building wxWidgets and its samples using MinGW is well documented.
viewtopic.php?f=19&t=47231
(You can use this guide even if you don't intend to use Code:Blocks. The first part about building from the command line still applies).
Use the source, Luke!
xemuth
In need of some credit
In need of some credit
Posts: 5
Joined: Mon Jan 18, 2021 3:35 pm

Re: Duplicate symbol: vtable for wxThreadHelperThread

Post by xemuth »

I will retry to compile the lib without MSYS. I will be back soon !
xemuth
In need of some credit
In need of some credit
Posts: 5
Joined: Mon Jan 18, 2021 3:35 pm

Re: Duplicate symbol: vtable for wxThreadHelperThread

Post by xemuth »

All right, I have rebuilt WxWidget using Mingw 32bit (like shown in the Code::Block / Mingw guide} ). difference is I don't want shared lib. so I did :

under WXWIN/build/msw

Code: Select all

 mingw32-make -f makefile.gcc BUILD=release SHELL=cmd.exe 
When it have been done, I had all lib*.a located under lib/gcc_lib/*
Image

using this, I setted up everything I need into my IDE to compile the Minimal sample:
first, includes :
Image
second, libs directories :
Image

I have set up my IDE to link with all .a file in gcc_lib :

Code: Select all

 libwxmsw31u_ribbon 
 libwxmsw31u_richtext 
 libwxmsw31u_stc 
 libwxmsw31u_webview 
 libwxmsw31u_xrc 
 libwxpng 
 libwxregexu 
 libwxscintilla 
 libwxtiff 
 libwxzlib 
 libwxbase31u 
 libwxbase31u_net 
 libwxbase31u_xml 
 libwxexpat 
 libwxjpeg 
 libwxmsw31u_adv 
 libwxmsw31u_aui 
 libwxmsw31u_core 
 libwxmsw31u_gl 
 libwxmsw31u_html 
 libwxmsw31u_media 
 libwxmsw31u_propgrid 

and then when I compile the minimal sample using my IDE :

Code: Select all

 (): Linking has failed
 (): C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/10.2.0/../../../../i686-w64-mingw32/bin/ld.exe: C:\wxWidgets-3.1.4\lib\gcc_lib\libwxbase31u.a(baselib_filename.o):filename.cpp:(.text+0x94ca): undefined reference to `IID_IShellLinkW'
...
 (): C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/10.2.0/../../../../i686-w64-mingw32/bin/ld.exe: C:\wxWidgets-3.1.4\lib\gcc_lib\libwxmsw31u_core.a(corelib_oleutils.o):oleutils.cpp:(.text$_ZN11wxSafeArrayILt5EE6AttachEP12tagSAFEARRAY[__ZN11wxSafeArrayILt5EE6AttachEP12tagSAFEARRA
Y]+0x89): undefined reference to `_imp__SafeArrayGetVartype@8'
...
 (): C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/10.2.0/../../../../i686-w64-mingw32/bin/ld.exe: C:\wxWidgets-3.1.4\lib\gcc_lib\libwxmsw31u_core.a(corelib_safearray.o):safearray.cpp:(.text+0x1250): undefined reference to `_imp__SafeArrayGetUBound@12'
I used the same compiler to compile WxWidget and this example. I don't get what's going wrong
User avatar
doublemax
Moderator
Moderator
Posts: 19115
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Duplicate symbol: vtable for wxThreadHelperThread

Post by doublemax »

You're getting closer :)

The missing references are all from Windows libraries. Did you add the "-mwindows" switch?

E.g. the "minimal" sample also links to these libs:

Code: Select all

-lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lshlwapi -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lversion -lwsock32 -lwininet -loleacc -luxtheme
Use the source, Luke!
xemuth
In need of some credit
In need of some credit
Posts: 5
Joined: Mon Jan 18, 2021 3:35 pm

Re: Duplicate symbol: vtable for wxThreadHelperThread

Post by xemuth »

doublemax wrote: Tue Jan 19, 2021 1:17 pm E.g. the "minimal" sample also links to these libs:

Code: Select all

-lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lshlwapi -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lversion -lwsock32 -lwsock32 -lwininet -loleacc -luxtheme
It work ! Thanks a lot ! :D

What you mean by ?
Did you add the "-mwindows" switch?
User avatar
doublemax
Moderator
Moderator
Posts: 19115
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Duplicate symbol: vtable for wxThreadHelperThread

Post by doublemax »

xemuth wrote: Tue Jan 19, 2021 1:36 pm What you mean by ?
Did you add the "-mwindows" switch?
That's usually part of the command line, but if everything works now, it was probably already there.
Use the source, Luke!
Post Reply