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



Relevant Pages

  • Re: Compile GNU Octave with SunStudio
    ... defining man1dir to be $/man1 ... Fortran libraries: -lz -lm -lf77compat ... configure: WARNING: command editing and history features require GNU Readline ... This will result in some lack of functionality for sparse matrices. ...
    (comp.unix.solaris)
  • databases/clip doesnt build
    ... creating cache ./config.cache ... checking whether the linker supports shared libraries... ... gtkcombobox.h:50: warning: data definition has no type or storage class ...
    (freebsd-questions)
  • re: "built-in" file I/O
    ... Wrong data input without warning. ... good example of best language design. ... but that's irrelevant to the I/O issue. ... is a wider range of options when one has libraries ...
    (comp.lang.pl1)
  • Errors Installing DBD::Oracle on Windows
    ... but with warnings of missing libraries. ... Note (probably harmless): ... Microsoft Program Maintenance Utility Version 1.50 ... Warning: ...
    (perl.dbi.users)
  • Re: Where to start on an error?
    ... arena.obj: error LNK2019: unresolved external symbol ___glutCreateWindowWithExit@8 referenced in function _glutCreateWindow_ATEXIT_HACK@4 ... The order of the libraries on the linker commandline is wrong. ... the libs must come after the libs or objectfiles that use ...
    (microsoft.public.vc.language)