multiple definition of __mingwthr_key_dtor
Danny Smith
dannysmith@clear.net.nz
Sat Feb 19 18:11:00 GMT 2005
Fabio Roger wrote:
> I'm trying to mix c++ and java objects, everything works fine in linux
> and cygwin if I link with -lstdc++
>> but using mingw32 (or cygwin with -mno-cygwin) it comes to this error:
>>> /usr/i686-pc-mingw32/lib/libgcj.a(win32.o)(.text+0x130):win32.cc:
> multiple definition of `___mingwthr_key_dtor'
>> /usr/i686-pc-mingw32/lib/libmingw32.a(mthr_stub.o)(.text
> +0x0):mthr_stub.c: first defined here
>> /usr/i686-pc-mingw32/lib/libgcj.a(win32.o)(.data+0x0):win32.cc: multiple
> definition of `__CRT_MT'
>> /usr/i686-pc-mingw32/lib/libmingw32.a(crtst.o)(.bss+0x0):crtst.c: first
> defined here
>>> this seems to be a known error, but I am googling around for 2 days and
> found no solution so far.
>> I believe the same case was caught here
> http://gcc.gnu.org/ml/java/2003-12/msg00127.html but it seems got
> nowhere.
>>> please, any ideas?
>
This is not the best solution, but to get rid of the multiple definition
errors when linking in C++ objects, link with -lgcj -lstdc++ (in that
order). This will bring in the libgcj:win32.cc definitions of the
symbols. The problem with this workaround is that it means your C++
module(s) will leak memory if they create threads, since they will be
using libgcj's bogus definition of __mingwthr_key_dtor.
Really this should be reported as a bug if one for this problem doesn't
already exist.
Danny
> thanks
>> Fabio Roger
>
More information about the Java
mailing list