Warning: duplicate section ... has different size

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
vid512
Experienced Solver
Experienced Solver
Posts: 52
Joined: Mon Feb 08, 2010 10:16 am

Warning: duplicate section ... has different size

Post by vid512 » Fri Nov 19, 2010 12:57 pm

I have built wx2.9 library using mingw32-make (mingw with gcc4):

Code: Select all

cd build\msw
mingw32-make -f makefile.gcc UNICODE=1 SHARED=0 MONOLITHIC=1 DEBUG=0
Now I use wx-config-win utility, with evironment variable WXWIN set to wx2.9 directory.

My linker command line is:

Code: Select all

mingw32-g++.exe  -o bin\wx29-release\hint.exe <project objects> -s -static-libgcc -static-libstdc++  -mthreads `wx-config --wxcfg=gcc_lib\mswud --libs` -mwindows
This gets expanded to:

Code: Select all

mingw32-g++.exe  -o bin\wx29-release\hint.exe <project objects> obj\wx29-release\resource.res  -s -static-libgcc -static-libstdc++  -mthreads -Lc:\dev\_tools\wxWidgets-2.9.1\lib\gcc_lib -lwxmsw29ud -lwxtiffd -lwxjpegd -lwxpngd -lwxzlibd -lwxregexud -lwxexpatd -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwxregexud -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32     -mwindows
And then I get tons of "Duplicate section ... has different size" warnings. First few of them:

Code: Select all

c:/dev/_tools/mingw-new/bin/../lib/gcc/mingw32/4.5.0/../../../../mingw32/bin/ld.exe: c:\dev\_tools\wxWidgets-2.9.1\lib\gcc_lib/libwxmsw29ud.a(monolib_window.o): warning: duplicate section `.rdata$_ZTSN9wxPrivate11HandlerImplI12wxEvtHandler7wxEventLb1EEE[typeinfo name for wxPrivate::HandlerImpl<wxEvtHandler, wxEvent, true>]' has different size
c:/dev/_tools/mingw-new/bin/../lib/gcc/mingw32/4.5.0/../../../../mingw32/bin/ld.exe: c:\dev\_tools\wxWidgets-2.9.1\lib\gcc_lib/libwxmsw29ud.a(monolib_mdi.o): warning: duplicate section `.rdata$_ZTV20wxMDIParentFrameBase[vtable for wxMDIParentFrameBase]' has different size
c:/dev/_tools/mingw-new/bin/../lib/gcc/mingw32/4.5.0/../../../../mingw32/bin/ld.exe: c:\dev\_tools\wxWidgets-2.9.1\lib\gcc_lib/libwxmsw29ud.a(monolib_mdi.o): warning: duplicate section `.rdata$_ZTV21wxMDIClientWindowBase[vtable for wxMDIClientWindowBase]' has different size
c:/dev/_tools/mingw-new/bin/../lib/gcc/mingw32/4.5.0/../../../../mingw32/bin/ld.exe: c:\dev\_tools\wxWidgets-2.9.1\lib\gcc_lib/libwxmsw29ud.a(monolib_mdi.o): warning: duplicate section `.rdata$_ZTS20wxEventFunctorMethodI14wxEventTypeTagI14wxCommandEventE12wxEvtHandler7wxEventS3_E[typeinfo name for wxEventFunctorMethod<wxEventTypeTag<wxCommandEvent>, wxEvtHandler, wxEvent, wxEvtHandler>]' has different size
c:/dev/_tools/mingw-new/bin/../lib/gcc/mingw32/4.5.0/../../../../mingw32/bin/ld.exe: c:\dev\_tools\wxWidgets-2.9.1\lib\gcc_lib/libwxmsw29ud.a(monolib_mdi.o): warning: duplicate section `.rdata$_ZTSN9wxPrivate11HandlerImplI12wxEvtHandler7wxEventLb1EEE[typeinfo name for wxPrivate::HandlerImpl<wxEvtHandler, wxEvent, true>]' has different size
...
The executable is created and seems to work allright. However I'd like to find cause of these warnings, and get rid of it.

Anyone has idea what could have gone wrong?

guyanqiu
Knows some wx things
Knows some wx things
Posts: 25
Joined: Sun Jun 13, 2010 2:44 pm

Re: Warning: duplicate section ... has different size

Post by guyanqiu » Tue Jul 17, 2012 2:51 am

我也遇到了这个问题,究其原因是因为头文件和库文件不一致导致的。

I met this trouble too, because of the header files is not in accordance with the lib files.
You should use the right header files, or link the right libs.

Post Reply