Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mingw multiple definition of _Unwind_resume

I know a similar question to this has already been asked but I have been unable to fix this issue for hours.

Basically I have a DLL with code in it and an application that calls it. Everything works fine but if I take the two outside of my development enviroment it says the program cannot start because libgcc_s_dw2 1.dll is missing from the computer.

This is fair enough considering it is not a development computer. So for distribution I added the compiler flags "-static-libgcc -static-libstdc++". I did this for the dll and for the application.

But when I compile the application I get the error:

"multiple definition of `_Unwind_Resume'"

I thought this was due to both the dll and the application having the static libraries built into them, and it is. But if both of them don't have the static libraries built in, the program will not run on end user machines.

How can I remove this error while still having no dependencies on the mingw libs? My IDE is Code::Blocks.

David

EDIT: here is the build log when building the application that links to the dll:

c:/mingw/bin/../lib/gcc/mingw32/4.6.2/libgcc_eh.a(unwind-dw2.o):(.text+0x298c): multiple definition of `_Unwind_Resume'

..\EquilibriumEngine\bin\Release\libEquilibriumEngine.dll.a(d000015.o):(.text+0x0): first defined here

collect2: ld returned 1 exit status

Process terminated with status 1 (0 minutes, 0 seconds)

2 errors, 0 warnings
like image 564
DavidColson Avatar asked Jun 29 '12 19:06

DavidColson


1 Answers

One hacky workaround that often works is to add this to your linker flags:

-Wl,-allow-multiple-definition
like image 119
Rafael Kitover Avatar answered Nov 10 '22 01:11

Rafael Kitover