Link to home
Start Free TrialLog in
Avatar of mosaicer
mosaicer

asked on

Linking warnings.

I've been getting some linking warnings that I don't know how to
get rid of.  The only way that I can get my program to compile
is to use \FORCE.  Has anyone else encountered the following
situation?

LINK : warning LNK4075: ignoring /INCREMENTAL due to /FORCE specification
MSVCRT.lib(MSVCRT.dll) : warning LNK4006: _malloc already defined in libcmtd.lib(dbgheap.obj); second definition ignored
MSVCRT.lib(MSVCRT.dll) : warning LNK4006: _fprintf already defined in libcmtd.lib(fprintf.obj); second definition ignored
MSVCRT.lib(MSVCRT.dll) : warning LNK4006: _realloc already defined in libcmtd.lib(dbgheap.obj); second definition ignored
MSVCRT.lib(MSVCRT.dll) : warning LNK4006: _free already defined in libcmtd.lib(dbgheap.obj); second definition ignored
LINK : warning LNK4098: defaultlib "MSVCRT" conflicts with use of other libs; use /NODEFAULTLIB:library

I've tried various combinations of using /NODEFAULTLIB
(including msvcrt.lib but not libcmtd.lib, etc, etc. etc) but each
of these results in more linking errors.

My program does run fine when I use the /FORCE option but it
does bother me that I'm unable to get rid of these warnings
altogether.

Any suggestions?
Avatar of vachooho
vachooho
Flag of United States of America image

menu Project->Settings
"Link" tab
category "Input"
Object/library modules: MSVCRT.lib libcmtd.lib
Ignore libraries: MSVCRT.lib libcmtd.lib

YOu tell DevStudio to ignore both libaraies and specify them in correct order - MSVCRT.lib first.

The error caused with the functions presented in both libraries.
Avatar of mosaicer
mosaicer

ASKER

Ok, tried that and I get:

LINK : warning LNK4075: ignoring /INCREMENTAL due to /FORCE specification
nafxcwd.lib(afxmem.obj) : warning LNK4006: "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) already defined in msvcrt.lib(MSVCRT.dll); second definition ignored
nafxcwd.lib(afxmem.obj) : warning LNK4006: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in msvcrt.lib(MSVCRT.dll); second definition ignored
libcmtd.lib(dbgheap.obj) : warning LNK4006: _malloc already defined in msvcrt.lib(MSVCRT.dll); second definition ignored
libcmtd.lib(dbgheap.obj) : warning LNK4006: _calloc already defined in msvcrt.lib(MSVCRT.dll); second definition ignored
libcmtd.lib(dbgheap.obj) : warning LNK4006: _realloc already defined in msvcrt.lib(MSVCRT.dll); second definition ignored
libcmtd.lib(dbgheap.obj) : warning LNK4006: __expand already defined in msvcrt.lib(MSVCRT.dll); second definition ignored
libcmtd.lib(dbgheap.obj) : warning LNK4006: _free already defined in msvcrt.lib(MSVCRT.dll); second definition ignored
libcmtd.lib(dbgheap.obj) : warning LNK4006: __msize already defined in msvcrt.lib(MSVCRT.dll); second definition ignored
libcmtd.lib(crt0dat.obj) : warning LNK4006: _exit already defined in msvcrt.lib(MSVCRT.dll); second definition ignored
libcmtd.lib(crt0dat.obj) : warning LNK4006: __exit already defined in msvcrt.lib(MSVCRT.dll); second definition ignored
libcmtd.lib(mbctype.obj) : warning LNK4006: __setmbcp already defined in msvcrt.lib(MSVCRT.dll); second definition ignored
libcmtd.lib(strcat.obj) : warning LNK4006: _strcpy already defined in msvcrt.lib(MSVCRT.dll); second definition ignored
libcmtd.lib(crt0init.obj) : warning LNK4006: ___xc_z already defined in msvcrt.lib(cinitexe.obj); second definition ignored
libcmtd.lib(crt0init.obj) : warning LNK4006: ___xc_a already defined in msvcrt.lib(cinitexe.obj); second definition ignored
libcmtd.lib(crt0init.obj) : warning LNK4006: ___xi_z already defined in msvcrt.lib(cinitexe.obj); second definition ignored
libcmtd.lib(crt0init.obj) : warning LNK4006: ___xi_a already defined in msvcrt.lib(cinitexe.obj); second definition ignored
libcmtd.lib(dosmap.obj) : warning LNK4006: ___doserrno already defined in msvcrt.lib(MSVCRT.dll); second definition ignored
libcmtd.lib(winxfltr.obj) : warning LNK4006: __XcptFilter already defined in msvcrt.lib(MSVCRT.dll); second definition ignored
libcmtd.lib(strftime.obj) : warning LNK4006: _strftime already defined in msvcrt.lib(MSVCRT.dll); second definition ignored
libcmtd.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/DibEditor.exe : warning LNK4088: image being generated due to /FORCE option; image may not run

DibEditor.exe - 1 error(s), 32 warning(s)
Avatar of Zoppo
See MSDN article Q148652...
You are probably trying to link multiple modules that have been compiled using different threading models. In Project Settings, C/C++ tab, Code Generation, change to a multithreaded model.
Yes, I've already got it set to
Debug Multithreaded.

The ordering thing is weird also.
According to Q148652, I need
to have it link
MSVCRT before LIBCMTD but when I do
that, I get a load of errors as
noted above.  If I do it the
other way (LIBCMTD first), then
I only get a few errors (first message).

Although the program runs fine with
the /FORCE, it is still a little
unsettling that I have to use this
in the first place.  It makes
me nervous when I can't get rid
of all of the warnings.


ASKER CERTIFIED SOLUTION
Avatar of Dhrubajyoti
Dhrubajyoti

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial