Hi,
This is an issue with the provider of the third-party library and the fact that
Microsoft have many ways to generate C code using the Microsoft C runtime library:
non-MT came with two variants (static and dynamic), MT came with the same
variants. In addition you have one more variation: debug vs non-debug version of
the libraries. And of course those are incompatible. In the Linux world this is
much easier, there is only one C runtime library.
We generate the code using /MT because this is the most widely used out there.
The easiest is to get the third-party library to be compiled with /MT and you
check with the provider on how to get this.
If this is not possible, then using -NODEFAULTLIB:libcmt in the linker flags would
have been the correct way to fix the errors, unfortunately it is most likely
guaranteed that the code will not work properly.
Thus the only thing you have left is to change the C compilation options from the
Eiffel configuration to compile your code using /MD including our runtime and all
the C code included in our libraries.
Manu
> -----Original Message-----
> From:
eiffel_...@yahoogroups.com
> [mailto:
eiffel_...@yahoogroups.com] On Behalf Of David Jenkins
> Sent: Thursday, October 11, 2012 10:09
> To:
eiffel_...@yahoogroups.com
> Subject: [eiffel_software] Linker errors using third-party library
>
> I've hit a snag building an Eiffel project for Windows7 that links a
> third-party static library. The third-party library is delivered as a MS
> Visual C++ 2010 solution with all necessary source files for creating the
> static library. It built successfully as delivered; I've made no changes
> to the Visual C++ solution configuration. I've added the .lib file that
> Visual C++ created to my Eiffel project as an external object, together
> with the necessary Includes. When I freeze the project, the Eiffel code
> compiles successfully, and the C++ compile also succeeds. However the
> linker raises a multitude of errors, all similar to this:
>
> msvcrt.lib(ti_inst.obj) : error LNK2005: "private: __thiscall
> type_info::type_info(class type_info const &)"
> (??0type_info@@AAE@ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj)
>
> After it's finished disgorging errors, it registers this final bit of
> advice:
>
> LIBCMT.lib(crt0init.obj) : warning LNK4098: defaultlib 'msvcrt.lib'
> conflicts with use of other libs; use /NODEFAULTLIB:library
> re2_test.exe : fatal error LNK1169: one or more multiply defined symbols
> found
>
> Is there something wrong with the way I've built the third-party library,
> or with the way I've configured my Eiffel project? The presence of many
> errors all refencing a conflict with LIBCMT.lib made me suspect that the
> third-party library was built as a multi-threaded solution (my Eiffel
> project is not multi-threaded), but I've checked and the Visual C++
> linker that built the third-party library is set to use /MD and not /MT
> (which I think means "build as a non-multi-threaded library").
>
> I also tried adding an "Externals | Linker flag" to my Eiffel external
> configuration, with Value = /NODEFAULTLIB:LIBCMT.lib. Whether or not this
> is correct, it had the unexpected result of adding the string
> "/NODEFAULTLIB:LIBCMT.lib" to the list of libraries to link and not as a
> linker flag, and of course raised an error. Should the "Externals |
> Linker flags" configuration option be used this way for Windows? Is
> adding this flag even the right way to solve my problem?
>
> I'd really appreciate any suggestions for fixing these linker issues.
>
> (BTW, I've built the same Eiffel project on Ubuntu, using the third-party
> library's Linux version. Everything works correctly there.)
>
> David Jenkins
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/eiffel_software/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/eiffel_software/join
(Yahoo! ID required)
<*> To change settings via email:
eiffel_soft...@yahoogroups.com
eiffel_softwar...@yahoogroups.com
<*> To unsubscribe from this group, send an email to:
eiffel_softwa...@yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/