DllMain@12 already defined in LIBCMTD.lib error

DllMain@12 already defined in LIBCMTD.lib error

I am trying to link a large mixed C/Fortran project and am getting the following errors: (note: as far as I know, I do not have any routines called DLLMain so it must the the default one)

Linking...
nafxcwd.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in LIBCMTD.lib(dllmain.obj)
nafxcwd.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) already defined in LIBCMTD.lib(new.obj)
nafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in LIBCMTD.lib(dbgdel.obj)
nafxcwd.lib(dllmodul.obj) : warning LNK4006: _DllMain@12 already defined in LIBCMTD.lib(dllmain.obj); second definition ignored
nafxcwd.lib(afxmem.obj) : warning LNK4006: "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) already defined in LIBCMTD.lib(new.obj); second definition ignored
nafxcwd.lib(afxmem.obj) : warning LNK4006: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in LIBCMTD.lib(dbgdel.obj); second definition ignored
Creating library Debug/T700Sim.lib and object Debug/T700Sim.exp
cdsTrace700T700WinV414.dll : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.

Here are my Fortran project settings:

/check:bounds /check:overflow /check:underflow /compile_only /debug:full /include:"Debug/" /dll /math_library:fast /nologo /threads /traceback /warn:argument_checking /warn:declarations /warn:nofileopt /module:"Debug/" /object:"Debug/" /pdbfile:"Debug/DF60.PDB"

Here are my C project settings:

/nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Fp"Debug/T700Win.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c

Here are my linker settings:

/nologo /subsystem:windows /dll /incremental:yes /pdb:"Debug/T700Sim.pdb" /debug /machine:I386 /nodefaultlib:"msvcrt.lib" /out:"cdsTrace700T700WinV414.dll" /implib:"Debug/T700Sim.lib" /pdbtype:sept

Let me know if anyone has an idea to resolve this.

Thanks,
Lawrence Scheier
SEI Associates

5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Lawrence,

I guess this is a Multiple C Library Syndrome. Take a look at this article

http://http://h18009.www1.hp.com/fortran/visual/vfn10/page2.html#Karam

and Steve's reply and useful suggestions in this thread

http://softwareforums.intel.com/ids/board/message?board.id=5&message.id=7805

A.

I don't see a solution from that suggestion. Perhaps if I knew what the nafxcwd.lib
(where the conflicts are arising) was, I'd be able to figure it out.

Larry Scheier

I think that's an MFC library. You may want to try adding libcmtd.lib into the "ignore libraries" list in the linker options.

Retired 12/31/2016

Larry,

it seemsthat the problem lies in the order libraries are linked in your project
(CRT libraryis linked before MFC lib). See this KB article.

http://support.microsoft.com/default.aspx?scid=kb;en-us;148652

Ihope thatthis will solvethe problem.

A.

Message Edited by ArturGuzik on 02-24-2004 07:58 PM

Leave a Comment

Please sign in to add a comment. Not a member? Join today