c compilation error: multiply defined symbols

4 messages Options
Embed this post
Permalink
Marco Trudel

c compilation error: multiply defined symbols

Reply Threaded More More options
Print post
Permalink
Dear all

When I add some externals needed by inline C code to my project,
freezing fails with:

MSVCRT.lib(MSVCR90.dll) : error LNK2005: _free already defined in
LIBCMT.lib(free.obj)
MSVCRT.lib(MSVCR90.dll) : error LNK2005: _malloc already defined in
LIBCMT.lib(malloc.obj)
MSVCRT.lib(MSVCR90.dll) : error LNK2005: ___iob_func already defined in
LIBCMT.lib(_file.obj)
MSVCRT.lib(MSVCR90.dll) : error LNK2005: _isprint already defined in
LIBCMT.lib(_ctype.obj)
MSVCRT.lib(MSVCR90.dll) : error LNK2005: _fprintf already defined in
LIBCMT.lib(fprintf.obj)
MSVCRT.lib(MSVCR90.dll) : error LNK2005: _memmove already defined in
LIBCMT.lib(memmove.obj)
MSVCRT.lib(MSVCR90.dll) : error LNK2005: _calloc already defined in
LIBCMT.lib(calloc.obj)
MSVCRT.lib(MSVCR90.dll) : error LNK2005: _realloc already defined in
LIBCMT.lib(realloc.obj)
MSVCRT.lib(MSVCR90.dll) : error LNK2005: _sprintf already defined in
LIBCMT.lib(sprintf.obj)
MSVCRT.lib(MSVCR90.dll) : error LNK2005: _exit already defined in
LIBCMT.lib(crt0dat.obj)
MSVCRT.lib(MSVCR90.dll) : error LNK2005: __strdup already defined in
LIBCMT.lib(strdup.obj)
MSVCRT.lib(MSVCR90.dll) : error LNK2005: _fopen already defined in
LIBCMT.lib(fopen.obj)
MSVCRT.lib(MSVCR90.dll) : error LNK2005: _fread already defined in
LIBCMT.lib(fread.obj)
MSVCRT.lib(MSVCR90.dll) : error LNK2005: _fclose already defined in
LIBCMT.lib(fclose.obj)
MSVCRT.lib(MSVCR90.dll) : error LNK2005: __stat64i32 already defined in
LIBCMT.lib(stati32.obj)
MSVCRT.lib(MSVCR90.dll) : error LNK2005: _toupper already defined in
LIBCMT.lib(toupper.obj)
MSVCRT.lib(MSVCR90.dll) : error LNK2005: _atoi already defined in
LIBCMT.lib(atox.obj)
MSVCRT.lib(MSVCR90.dll) : error LNK2005: _isdigit already defined in
LIBCMT.lib(_ctype.obj)
    Creating library project3.lib and object project3.exp
LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other
libs; use /NODEFAULTLIB:library
project3.exe : fatal error LNK1169: one or more multiply defined symbols
found


If I manually add "-NODEFAULTLIB:MSVCRT" to the makefile, I get some
warnings during (manual nmake) compilation but the created binary works.
If I manually add "-NODEFAULTLIB:LIBCMT" to the makefile, I get no
warnings during (manual nmake) compilation and the created file works
only in the W_code directory (in other directories, I get an error that
MSVCR89.dll was not found).

Does anyone have insights on what's going wrong and on how to fix it? I
have no clue what's pulling in what...


Thanks
Marco
Marco Trudel

Re: c compilation error: multiply defined symbols

Reply Threaded More More options
Print post
Permalink
I now set "Omit Default Library Names" to "Yes" for the external
library. This way, EiffelStudio is able to compile the project as usual
but I get a lot of C compilation warnings like:

antlr3c.lib(antlr3exception.obj) : warning LNK4049: locally defined
symbol _fprintf imported
antlr3c.lib(antlr3basetree.obj) : warning LNK4049: locally defined
symbol _fprintf imported
antlr3c.lib(antlr3lexer.obj) : warning LNK4217: locally defined symbol
_fprintf imported in function _mTokens
antlr3c.lib(antlr3rewritestreams.obj) : warning LNK4049: locally defined
symbol _fprintf imported
antlr3c.lib(antlr3baserecognizer.obj) : warning LNK4049: locally defined
symbol _fprintf imported
antlr3c.lib(antlr3basetreeadaptor.obj) : warning LNK4049: locally
defined symbol _fprintf imported
antlr3c.lib(antlr3exception.obj) : warning LNK4217: locally defined
symbol ___iob_func imported in function _antlr3ExceptionPrint
antlr3c.lib(antlr3basetree.obj) : warning LNK4049: locally defined
symbol ___iob_func imported
antlr3c.lib(antlr3lexer.obj) : warning LNK4217: locally defined symbol
___iob_func imported in function _mTokens
antlr3c.lib(antlr3rewritestreams.obj) : warning LNK4049: locally defined
symbol ___iob_func imported


Doesn't look exactly clean to me (but at least it works)...

Thanks
Marco


Marco Trudel wrote:

> Dear all
>
> When I add some externals needed by inline C code to my project,
> freezing fails with:
>
> MSVCRT.lib(MSVCR90.dll) : error LNK2005: _free already defined in
> LIBCMT.lib(free.obj)
> MSVCRT.lib(MSVCR90.dll) : error LNK2005: _malloc already defined in
> LIBCMT.lib(malloc.obj)
> MSVCRT.lib(MSVCR90.dll) : error LNK2005: ___iob_func already defined in
> LIBCMT.lib(_file.obj)
> MSVCRT.lib(MSVCR90.dll) : error LNK2005: _isprint already defined in
> LIBCMT.lib(_ctype.obj)
> MSVCRT.lib(MSVCR90.dll) : error LNK2005: _fprintf already defined in
> LIBCMT.lib(fprintf.obj)
> MSVCRT.lib(MSVCR90.dll) : error LNK2005: _memmove already defined in
> LIBCMT.lib(memmove.obj)
> MSVCRT.lib(MSVCR90.dll) : error LNK2005: _calloc already defined in
> LIBCMT.lib(calloc.obj)
> MSVCRT.lib(MSVCR90.dll) : error LNK2005: _realloc already defined in
> LIBCMT.lib(realloc.obj)
> MSVCRT.lib(MSVCR90.dll) : error LNK2005: _sprintf already defined in
> LIBCMT.lib(sprintf.obj)
> MSVCRT.lib(MSVCR90.dll) : error LNK2005: _exit already defined in
> LIBCMT.lib(crt0dat.obj)
> MSVCRT.lib(MSVCR90.dll) : error LNK2005: __strdup already defined in
> LIBCMT.lib(strdup.obj)
> MSVCRT.lib(MSVCR90.dll) : error LNK2005: _fopen already defined in
> LIBCMT.lib(fopen.obj)
> MSVCRT.lib(MSVCR90.dll) : error LNK2005: _fread already defined in
> LIBCMT.lib(fread.obj)
> MSVCRT.lib(MSVCR90.dll) : error LNK2005: _fclose already defined in
> LIBCMT.lib(fclose.obj)
> MSVCRT.lib(MSVCR90.dll) : error LNK2005: __stat64i32 already defined in
> LIBCMT.lib(stati32.obj)
> MSVCRT.lib(MSVCR90.dll) : error LNK2005: _toupper already defined in
> LIBCMT.lib(toupper.obj)
> MSVCRT.lib(MSVCR90.dll) : error LNK2005: _atoi already defined in
> LIBCMT.lib(atox.obj)
> MSVCRT.lib(MSVCR90.dll) : error LNK2005: _isdigit already defined in
> LIBCMT.lib(_ctype.obj)
>     Creating library project3.lib and object project3.exp
> LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other
> libs; use /NODEFAULTLIB:library
> project3.exe : fatal error LNK1169: one or more multiply defined symbols
> found
>
>
> If I manually add "-NODEFAULTLIB:MSVCRT" to the makefile, I get some
> warnings during (manual nmake) compilation but the created binary works.
> If I manually add "-NODEFAULTLIB:LIBCMT" to the makefile, I get no
> warnings during (manual nmake) compilation and the created file works
> only in the W_code directory (in other directories, I get an error that
> MSVCR89.dll was not found).
>
> Does anyone have insights on what's going wrong and on how to fix it? I
> have no clue what's pulling in what...
>
>
> Thanks
> Marco
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>

Emmanuel Stapf

RE: c compilation error: multiply defined symbols

Reply Threaded More More options
Print post
Permalink
You have to get a version of antlr3c.lib which is compiled with the MT option and
not with the MD option. Or better recompile it yourself with the MT option. Those
warnings could be problematic and I certainly recommend finding a way to fix them.

Regards,
Manu

> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of Marco Trudel
> Sent: Wednesday, August 19, 2009 6:32 AM
> To: [hidden email]
> Subject: Re: [eiffel_software] c compilation error: multiply defined
> symbols
>
> I now set "Omit Default Library Names" to "Yes" for the external
> library. This way, EiffelStudio is able to compile the project as usual
> but I get a lot of C compilation warnings like:
>
> antlr3c.lib(antlr3exception.obj) : warning LNK4049: locally defined
> symbol _fprintf imported
> antlr3c.lib(antlr3basetree.obj) : warning LNK4049: locally defined
> symbol _fprintf imported
> antlr3c.lib(antlr3lexer.obj) : warning LNK4217: locally defined symbol
> _fprintf imported in function _mTokens
> antlr3c.lib(antlr3rewritestreams.obj) : warning LNK4049: locally defined
> symbol _fprintf imported
> antlr3c.lib(antlr3baserecognizer.obj) : warning LNK4049: locally defined
> symbol _fprintf imported
> antlr3c.lib(antlr3basetreeadaptor.obj) : warning LNK4049: locally
> defined symbol _fprintf imported
> antlr3c.lib(antlr3exception.obj) : warning LNK4217: locally defined
> symbol ___iob_func imported in function _antlr3ExceptionPrint
> antlr3c.lib(antlr3basetree.obj) : warning LNK4049: locally defined
> symbol ___iob_func imported
> antlr3c.lib(antlr3lexer.obj) : warning LNK4217: locally defined symbol
> ___iob_func imported in function _mTokens
> antlr3c.lib(antlr3rewritestreams.obj) : warning LNK4049: locally defined
> symbol ___iob_func imported
>
>
> Doesn't look exactly clean to me (but at least it works)...
>
> Thanks
> Marco
>
>
> Marco Trudel wrote:
> > Dear all
> >
> > When I add some externals needed by inline C code to my project,
> > freezing fails with:
> >
> > MSVCRT.lib(MSVCR90.dll) : error LNK2005: _free already defined in
> > LIBCMT.lib(free.obj)
> > MSVCRT.lib(MSVCR90.dll) : error LNK2005: _malloc already defined in
> > LIBCMT.lib(malloc.obj)
> > MSVCRT.lib(MSVCR90.dll) : error LNK2005: ___iob_func already defined in
> > LIBCMT.lib(_file.obj)
> > MSVCRT.lib(MSVCR90.dll) : error LNK2005: _isprint already defined in
> > LIBCMT.lib(_ctype.obj)
> > MSVCRT.lib(MSVCR90.dll) : error LNK2005: _fprintf already defined in
> > LIBCMT.lib(fprintf.obj)
> > MSVCRT.lib(MSVCR90.dll) : error LNK2005: _memmove already defined in
> > LIBCMT.lib(memmove.obj)
> > MSVCRT.lib(MSVCR90.dll) : error LNK2005: _calloc already defined in
> > LIBCMT.lib(calloc.obj)
> > MSVCRT.lib(MSVCR90.dll) : error LNK2005: _realloc already defined in
> > LIBCMT.lib(realloc.obj)
> > MSVCRT.lib(MSVCR90.dll) : error LNK2005: _sprintf already defined in
> > LIBCMT.lib(sprintf.obj)
> > MSVCRT.lib(MSVCR90.dll) : error LNK2005: _exit already defined in
> > LIBCMT.lib(crt0dat.obj)
> > MSVCRT.lib(MSVCR90.dll) : error LNK2005: __strdup already defined in
> > LIBCMT.lib(strdup.obj)
> > MSVCRT.lib(MSVCR90.dll) : error LNK2005: _fopen already defined in
> > LIBCMT.lib(fopen.obj)
> > MSVCRT.lib(MSVCR90.dll) : error LNK2005: _fread already defined in
> > LIBCMT.lib(fread.obj)
> > MSVCRT.lib(MSVCR90.dll) : error LNK2005: _fclose already defined in
> > LIBCMT.lib(fclose.obj)
> > MSVCRT.lib(MSVCR90.dll) : error LNK2005: __stat64i32 already defined in
> > LIBCMT.lib(stati32.obj)
> > MSVCRT.lib(MSVCR90.dll) : error LNK2005: _toupper already defined in
> > LIBCMT.lib(toupper.obj)
> > MSVCRT.lib(MSVCR90.dll) : error LNK2005: _atoi already defined in
> > LIBCMT.lib(atox.obj)
> > MSVCRT.lib(MSVCR90.dll) : error LNK2005: _isdigit already defined in
> > LIBCMT.lib(_ctype.obj)
> >     Creating library project3.lib and object project3.exp
> > LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other
> > libs; use /NODEFAULTLIB:library
> > project3.exe : fatal error LNK1169: one or more multiply defined
> symbols
> > found
> >
> >
> > If I manually add "-NODEFAULTLIB:MSVCRT" to the makefile, I get some
> > warnings during (manual nmake) compilation but the created binary
> works.
> > If I manually add "-NODEFAULTLIB:LIBCMT" to the makefile, I get no
> > warnings during (manual nmake) compilation and the created file works
> > only in the W_code directory (in other directories, I get an error that
> > MSVCR89.dll was not found).
> >
> > Does anyone have insights on what's going wrong and on how to fix it? I
> > have no clue what's pulling in what...
> >
> >
> > Thanks
> > Marco
> >
> >
> > ------------------------------------
> >
> > Yahoo! Groups Links
> >
> >
> >
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>

------------------------------------------------------------------------  
Eiffel Software
805-685-1006
http://www.eiffel.com       
Customer support: http://support.eiffel.com       
User group: http://groups.eiffel.com/join       
------------------------------------------------------------------------  
Marco Trudel

Re: c compilation error: multiply defined symbols

Reply Threaded More More options
Print post
Permalink
Dear Manu

Emmanuel Stapf [ES] wrote:
> You have to get a version of antlr3c.lib which is compiled with the MT option and
> not with the MD option.

Yep, that did the trick. Now everything compiles fine without errors or
warnings.


Thanks a lot
Marco


> Or better recompile it yourself with the MT option. Those
> warnings could be problematic and I certainly recommend finding a way to fix them.
>
> Regards,
> Manu
>
>> -----Original Message-----
>> From: [hidden email]
>> [mailto:[hidden email]] On Behalf Of Marco Trudel
>> Sent: Wednesday, August 19, 2009 6:32 AM
>> To: [hidden email]
>> Subject: Re: [eiffel_software] c compilation error: multiply defined
>> symbols
>>
>> I now set "Omit Default Library Names" to "Yes" for the external
>> library. This way, EiffelStudio is able to compile the project as usual
>> but I get a lot of C compilation warnings like:
>>
>> antlr3c.lib(antlr3exception.obj) : warning LNK4049: locally defined
>> symbol _fprintf imported
>> antlr3c.lib(antlr3basetree.obj) : warning LNK4049: locally defined
>> symbol _fprintf imported
>> antlr3c.lib(antlr3lexer.obj) : warning LNK4217: locally defined symbol
>> _fprintf imported in function _mTokens
>> antlr3c.lib(antlr3rewritestreams.obj) : warning LNK4049: locally defined
>> symbol _fprintf imported
>> antlr3c.lib(antlr3baserecognizer.obj) : warning LNK4049: locally defined
>> symbol _fprintf imported
>> antlr3c.lib(antlr3basetreeadaptor.obj) : warning LNK4049: locally
>> defined symbol _fprintf imported
>> antlr3c.lib(antlr3exception.obj) : warning LNK4217: locally defined
>> symbol ___iob_func imported in function _antlr3ExceptionPrint
>> antlr3c.lib(antlr3basetree.obj) : warning LNK4049: locally defined
>> symbol ___iob_func imported
>> antlr3c.lib(antlr3lexer.obj) : warning LNK4217: locally defined symbol
>> ___iob_func imported in function _mTokens
>> antlr3c.lib(antlr3rewritestreams.obj) : warning LNK4049: locally defined
>> symbol ___iob_func imported
>>
>>
>> Doesn't look exactly clean to me (but at least it works)...
>>
>> Thanks
>> Marco
>>
>>
>> Marco Trudel wrote:
>>> Dear all
>>>
>>> When I add some externals needed by inline C code to my project,
>>> freezing fails with:
>>>
>>> MSVCRT.lib(MSVCR90.dll) : error LNK2005: _free already defined in
>>> LIBCMT.lib(free.obj)
>>> MSVCRT.lib(MSVCR90.dll) : error LNK2005: _malloc already defined in
>>> LIBCMT.lib(malloc.obj)
>>> MSVCRT.lib(MSVCR90.dll) : error LNK2005: ___iob_func already defined in
>>> LIBCMT.lib(_file.obj)
>>> MSVCRT.lib(MSVCR90.dll) : error LNK2005: _isprint already defined in
>>> LIBCMT.lib(_ctype.obj)
>>> MSVCRT.lib(MSVCR90.dll) : error LNK2005: _fprintf already defined in
>>> LIBCMT.lib(fprintf.obj)
>>> MSVCRT.lib(MSVCR90.dll) : error LNK2005: _memmove already defined in
>>> LIBCMT.lib(memmove.obj)
>>> MSVCRT.lib(MSVCR90.dll) : error LNK2005: _calloc already defined in
>>> LIBCMT.lib(calloc.obj)
>>> MSVCRT.lib(MSVCR90.dll) : error LNK2005: _realloc already defined in
>>> LIBCMT.lib(realloc.obj)
>>> MSVCRT.lib(MSVCR90.dll) : error LNK2005: _sprintf already defined in
>>> LIBCMT.lib(sprintf.obj)
>>> MSVCRT.lib(MSVCR90.dll) : error LNK2005: _exit already defined in
>>> LIBCMT.lib(crt0dat.obj)
>>> MSVCRT.lib(MSVCR90.dll) : error LNK2005: __strdup already defined in
>>> LIBCMT.lib(strdup.obj)
>>> MSVCRT.lib(MSVCR90.dll) : error LNK2005: _fopen already defined in
>>> LIBCMT.lib(fopen.obj)
>>> MSVCRT.lib(MSVCR90.dll) : error LNK2005: _fread already defined in
>>> LIBCMT.lib(fread.obj)
>>> MSVCRT.lib(MSVCR90.dll) : error LNK2005: _fclose already defined in
>>> LIBCMT.lib(fclose.obj)
>>> MSVCRT.lib(MSVCR90.dll) : error LNK2005: __stat64i32 already defined in
>>> LIBCMT.lib(stati32.obj)
>>> MSVCRT.lib(MSVCR90.dll) : error LNK2005: _toupper already defined in
>>> LIBCMT.lib(toupper.obj)
>>> MSVCRT.lib(MSVCR90.dll) : error LNK2005: _atoi already defined in
>>> LIBCMT.lib(atox.obj)
>>> MSVCRT.lib(MSVCR90.dll) : error LNK2005: _isdigit already defined in
>>> LIBCMT.lib(_ctype.obj)
>>>     Creating library project3.lib and object project3.exp
>>> LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other
>>> libs; use /NODEFAULTLIB:library
>>> project3.exe : fatal error LNK1169: one or more multiply defined
>> symbols
>>> found
>>>
>>>
>>> If I manually add "-NODEFAULTLIB:MSVCRT" to the makefile, I get some
>>> warnings during (manual nmake) compilation but the created binary
>> works.
>>> If I manually add "-NODEFAULTLIB:LIBCMT" to the makefile, I get no
>>> warnings during (manual nmake) compilation and the created file works
>>> only in the W_code directory (in other directories, I get an error that
>>> MSVCR89.dll was not found).
>>>
>>> Does anyone have insights on what's going wrong and on how to fix it? I
>>> have no clue what's pulling in what...
>>>
>>>
>>> Thanks
>>> Marco
>>>
>>>
>>> ------------------------------------
>>>
>>> Yahoo! Groups Links
>>>
>>>
>>>
>>
>>
>> ------------------------------------
>>
>> Yahoo! Groups Links
>>
>>
>>
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>