none
LNK2005 in debug mode only(VS2005) RRS feed

  • Question

  • I am encountering error LNK2005 when I am building my DLL. The queer thing bout this is that this happens only in the debug mode while it runs fine in release mode.

    I have attached the linker options for both debug and release modes.

     

    Release Mode:

    /VERBOSE /OUT:"..\..\..\Bin\Release/man.dll" /INCREMENTAL:NO /NOLOGO /DLL /MANIFEST /MANIFESTFILE:"Release\man.dll.intermediate.manifest" /DEF:"..\man.def" /DEBUG /PDB:"..\Release\man.pdb" /SUBSYSTEM:WINDOWS /OPT:REF /OPT:ICF /LTCG /IMPLIB:".\Release\man.lib" /MACHINE:X86 /ERRORREPORT:PROMPT Setupapi.lib Shlwapi.lib \msi.lib ..\..\..\Libraries\base\release\base.lib ..\..\..\Libraries\func\Release\func.lib ".\release\ceg_vs80.lib" ".\release\cpeg_vs80.lib" ".\release\cceg_vs80.lib" ".\release\cfeg_vs80.lib" ".\release\creg_vs80.lib"

    Debug mode:

    /OUT:"..\..\..\Bin\Debug/man.dll" /NOLOGO /DLL /MANIFEST /MANIFESTFILE:"Debug\man.dll.intermediate.manifest" /DEF:"..\man.def" /DEBUG /PDB:"..\Debug\man.pdb" /SUBSYSTEM:WINDOWS /IMPLIB:".\Debug/man.lib" /MACHINE:X86 /ERRORREPORT:PROMPT Setupapi.lib Shlwapi.lib  ..\..\..\Libraries\base\Debug\base.lib ..\..\..\Libraries\func\Debug\func.lib ".\debug\ceg_vs80.lib" ".\debug\cpeg_vs80.lib" ".\debug\cceg_vs80.lib" ".\debug\cfeg_vs80.lib" ".\debug\creg_vs80.lib"

    This dll calls from MFC extension dlls base.dll and func.dll . And cfeg_vs80,cceg_vs80,creg_vs80,cfeg_vs80 are projects in man.sln and are the project dependencies for man.vcproj. Though the solution runs fine in release mode, only in debug mode it throws errors like

    base.lib (base.dll) "public: __thiscall CVersion::~CVersion(void)" (??1CVersion@@QAE@XZ) already defined in man.obj"

    Does the linker behave differently for debug and release mode in VS2005?

     

     

     

    Friday, November 24, 2006 10:12 AM

Answers

  • you have a destructor somewhere, in the code or any framework you are using, with #ifdef _DEBUG surrounded and you are inheriting that  class ( virtual class hopefully...) somewhere in your code..

    that is all I can think of...

    Friday, November 24, 2006 11:36 AM

All replies

  • you have a destructor somewhere, in the code or any framework you are using, with #ifdef _DEBUG surrounded and you are inheriting that  class ( virtual class hopefully...) somewhere in your code..

    that is all I can think of...

    Friday, November 24, 2006 11:36 AM
  •  

    1>------ Build started: Project: abc, Configuration: Debug Win32 ------

    1>Linking...

    1>libcmt.lib(invarg.obj) : error LNK2005: __initp_misc_invarg already defined in libcmtd.lib(invarg.obj)

    1>libcmt.lib(invarg.obj) : error LNK2005: __invoke_watson already defined in libcmtd.lib(invarg.obj)

    1>libcmt.lib(invarg.obj) : error LNK2005: __set_invalid_parameter_handler already defined in libcmtd.lib(invarg.obj)

    1>libcmt.lib(invarg.obj) : error LNK2005: __get_invalid_parameter_handler already defined in libcmtd.lib(invarg.obj)

    1>libcmt.lib(invarg.obj) : error LNK2005: "void __cdecl _invoke_watson(unsigned short const *,unsigned short const *,unsigned short const *,unsigned int,unsigned int)" (?_invoke_watson@@YAXPBG00II@Z) already defined in libcmtd.lib(invarg.obj)

    1>libcmt.lib(invarg.obj) : error LNK2005: __invalid_parameter already defined in libcmtd.lib(invarg.obj)

    1>libcmt.lib(invarg.obj) : error LNK2005: "void __cdecl _invalid_parameter(unsigned short const *,unsigned short const *,unsigned short const *,unsigned int,unsigned int)" (?_invalid_parameter@@YAXPBG00II@Z) already defined in libcmtd.lib(invarg.obj)

    1>libcmt.lib(invarg.obj) : error LNK2005: ___pInvalidArgHandler already defined in libcmtd.lib(invarg.obj)

    1> Creating library .\..\..\xlib/abc.lib and object .\..\..\xlib/abc.exp

    1>uafxcwd.lib(nolib.obj) : warning LNK4098: defaultlib 'uafxcw.lib' conflicts with use of other libs; use /NODEFAULTLIB:library

    1>libcmtd.lib(crt0init.obj) : warning LNK4098: defaultlib 'libcmt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library

    1>..\..\xxxxx\abc.dll : fatal error LNK1169: one or more multiply defined symbols found

     

    I dont know what is the reason, earlier it was working fine with both release and debug version build. I am buidlign usign NANT/msbuild scripts. The thing which i done is updated my system with XP SP3 (from sp2) and all critical updated. Hopefully these may be not the cause of the problem and may not requiere me to roll back to previous state ?

     


    AKS
    Tuesday, February 3, 2009 3:37 AM