LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs 
Author Message
 LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs

I get the following warning when compiling my VC++ 7.1 application converted
from 6.0:

LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other
libs; use /NODEFAULTLIB:library

When I used the /NODEFAULTLIB:library option, I get a bunch of link errors
on my MFC classes, such as the following

error LNK2020: unresolved token (0A000054)
ATL.CStringT<char,StrTraitMFC_DLL<char,ATL::ChTraitsCRT<char>>>.__dtor
error LNK2020: unresolved token (0A000051)  CFileFind.__dor
error LNK2020: unresolved token (0A000087)  CObject.delete
error LNK2020: unresolved token (0A0000104)  CDialog.__dtor

Should I be concerned about the warning?  If so, any thoughts of how to
resolved this?

Thanks,
Barry



Fri, 07 Oct 2005 21:39:57 GMT  
 LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs
I turned the /NODEFAULTLIB:library option off and just ignored the warning.
When I ran the application, it could not load one of the libraries.  The
library is a C runtime library (with .lib extension) that's set in
Additional Dependencies from the project's property pages under
Configuration Properties|Linker|Input.  I have to be able to use this
runtime library.  How do I get it to work?


Quote:
> I get the following warning when compiling my VC++ 7.1 application
converted
> from 6.0:

> LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other
> libs; use /NODEFAULTLIB:library

> When I used the /NODEFAULTLIB:library option, I get a bunch of link errors
> on my MFC classes, such as the following

> error LNK2020: unresolved token (0A000054)
> ATL.CStringT<char,StrTraitMFC_DLL<char,ATL::ChTraitsCRT<char>>>.__dtor
> error LNK2020: unresolved token (0A000051)  CFileFind.__dor
> error LNK2020: unresolved token (0A000087)  CObject.delete
> error LNK2020: unresolved token (0A0000104)  CDialog.__dtor

> Should I be concerned about the warning?  If so, any thoughts of how to
> resolved this?

> Thanks,
> Barry



Fri, 07 Oct 2005 22:39:42 GMT  
 LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs
I added MSVCRT.lib to Ignore Specific Library setting and it now links
cleanly.

-- Barry


Quote:
> I get the following warning when compiling my VC++ 7.1 application
converted
> from 6.0:

> LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other
> libs; use /NODEFAULTLIB:library

> When I used the /NODEFAULTLIB:library option, I get a bunch of link errors
> on my MFC classes, such as the following

> error LNK2020: unresolved token (0A000054)
> ATL.CStringT<char,StrTraitMFC_DLL<char,ATL::ChTraitsCRT<char>>>.__dtor
> error LNK2020: unresolved token (0A000051)  CFileFind.__dor
> error LNK2020: unresolved token (0A000087)  CObject.delete
> error LNK2020: unresolved token (0A0000104)  CDialog.__dtor

> Should I be concerned about the warning?  If so, any thoughts of how to
> resolved this?

> Thanks,
> Barry



Sun, 09 Oct 2005 22:22:35 GMT  
 LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs

--------------------

Quote:


>Subject: Re: LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs
>Date: Wed, 23 Apr 2003 10:22:35 -0400

>I added MSVCRT.lib to Ignore Specific Library setting and it now links
>cleanly.

>-- Barry



>> I get the following warning when compiling my VC++ 7.1 application
>converted
>> from 6.0:

>> LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other
>> libs; use /NODEFAULTLIB:library

>> When I used the /NODEFAULTLIB:library option, I get a bunch of link
errors
>> on my MFC classes, such as the following

>> error LNK2020: unresolved token (0A000054)
>> ATL.CStringT<char,StrTraitMFC_DLL<char,ATL::ChTraitsCRT<char>>>.__dtor
>> error LNK2020: unresolved token (0A000051)  CFileFind.__dor
>> error LNK2020: unresolved token (0A000087)  CObject.delete
>> error LNK2020: unresolved token (0A0000104)  CDialog.__dtor

>> Should I be concerned about the warning?  If so, any thoughts of how to
>> resolved this?

>> Thanks,
>> Barry

Barry,

The problem you were running into is probably that you have some things
built as /MD (where the CRT and MFC go in DLLs) and some built as /MT or
/ML (where the CRT and MFC are statically linked).   If ignoring msvcrt.lib
causes it to link then you probably have something built as /MD that's
embeddeding the default /MD CRT library name of msvcrt.lib in a .OBJ or
LIB file while you have other things that expect to link to libcmt.lib or
libc.lib.

--
Richard Kuhn, Visual C++ Team
This posting is provided AS IS with no warranties, and confers no rights.



Tue, 25 Oct 2005 02:48:05 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. LINK : warning LNK4098: defaultlib "LIBC" conflicts with use of other libs; use /NODEFAULTLIB:library

2. LINK : warning LNK4098: defaultlib "LIBCD" conflicts with use of other libs;use /NODEFAULTLIB:library

3. Getting: warning LNK4098: defaultlib "LIBCMT"

4. __argv fails in dll when using multi-threaded msvcrt dll's

5. gnu's malloc.h and NeXT's stdlib.h: conflicting types for mstats

6. X graphics libs for 'C' question

7. defaultlib conflict?!

8. defaultlib "LIBCMTD" conflicts

9. Help:EXE runs on some comp's, not others

10. Setting up Remote Debugging / I can't install the msvcrt.dll

11. MSVCRT conflicts with other libraries

12. Help, MSVCRT and LIBCD conflict

 

 
Powered by phpBB® Forum Software