compile with other libraries (.lib) ?

From: Wes (saruman_at_pandora.be)
Date: 09/04/04


Date: Sat, 4 Sep 2004 15:29:16 +0200

In our application (MFC dlg-based) we use libraries from other software
vendors.
MFC is compiled staticly, and so are all other libraries.

But with one library, I get the following errors/warnings:
MSVCRTD.lib(MSVCR71D.dll) : error LNK2005: _fread already defined in
libcmtd.lib(fread.obj)
MSVCRTD.lib(MSVCR71D.dll) : error LNK2005: _ftell already defined in
libcmtd.lib(ftell.obj)
MSVCRTD.lib(MSVCR71D.dll) : warning LNK4006: _fread already defined in
libcmtd.lib(fread.obj); second definition ignored
MSVCRTD.lib(MSVCR71D.dll) : warning LNK4006: _ftell already defined in
libcmtd.lib(ftell.obj); second definition ignored
LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other
libs; use /NODEFAULTLIB:library
LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other
libs; use /NODEFAULTLIB:library

Then, I tried to do the following steps:

A) added 'LIBCMT' + 'MSVCRTD' to /NODEFAULTLIB and got the following 2
errors:
OLDNAMES.lib(stat.obi) : error LNK2001: unresolved external symbol
__imp__stat
OLDNAMES.lib(stat.obi) : error LNK2001: unresolved external symbol
__imp___stat

'__imp___stat' has something to do with stat() function I think.
I get also warnings saying that a locally defined 'symbol' is used in a
function in the library (instead of using the 'symbol' from one of the
standard libraries). But I think this is normal.

B) If I don't use NODEFAULTLIB, but only /FORCE:MULTIPLE I get no errors,
but warnings:
LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other
libs; use /NODEFAULTLIB:library
LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other
libs; use /NODEFAULTLIB:library
MSVCRTD.lib(MSVCR71D.dll) : warning LNK4006: _fread already defined in
libcmtd.lib(fread.obj); second definition ignored
MSVCRTD.lib(MSVCR71D.dll) : warning LNK4006: _ftell already defined in
libcmtd.lib(ftell.obj); second definition ignored

So, I'm a little confused how I should use this library correctly.
Any help, ideas,..
thx