locked
VS2012 RC, linker bugs

    Question

  • Hi,

    I am compiling a big c++ sdk composed of static libraries with VS2012RC with Metro app support but at the end I have the following linker errors :

    1>globalization.obj : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/OPT:ICF' specification
    1>     Creating library Win32\Debug\RMSDKWrapperCPP.lib and object Win32\Debug\RMSDKWrapperCPP.exp
    1>hobbes.lib(xda_expander.obj) : error LNK2001: unresolved external symbol "void __cdecl operator delete(void *,int,char const *,int)" (??3@YAXPAXHPBDH@Z)
    1>xml.lib(uft_buffer.obj) : error LNK2019: unresolved external symbol "void __cdecl operator delete(void *,int,char const *,int)" (??3@YAXPAXHPBDH@Z) referenced in function __unwindfunclet$?init@SubBufferManager@uft@@SAXPAUBufferRec@2@ABVBuffer@2@III@Z$0
    1>xml.lib(mdom.obj) : error LNK2001: unresolved external symbol "void __cdecl operator delete(void *,int,char const *,int)" (??3@YAXPAXHPBDH@Z)
    1>xml.lib(xpath_context.obj) : error LNK2001: unresolved external symbol "void __cdecl operator delete(void *,int,char const *,int)" (??3@YAXPAXHPBDH@Z)
    1>xml.lib(xpath_step.obj) : error LNK2001: unresolved external symbol "void __cdecl operator delete(void *,int,char const *,int)" (??3@YAXPAXHPBDH@Z)
    1>xml.lib(mdom_util.obj) : error LNK2019: unresolved external symbol "void __cdecl operator delete[](void *,int,char const *,int)" (??_V@YAXPAXHPBDH@Z) referenced in function __unwindfunclet$??0SourceNodeLine@mdom@@QAE@ABVNode@1@0@Z$2
    1>xml.lib(xpath_term.obj) : error LNK2001: unresolved external symbol "void __cdecl operator delete[](void *,int,char const *,int)" (??_V@YAXPAXHPBDH@Z)
    1>Win32\Debug\RMSDKWrapperCPP.dll : fatal error LNK1120: 2 unresolved externals 

    I found some answer on stackoverflow but I am already applying what is suggested because all my projects are compiled with VS2012RC. (http://stackoverflow.com/questions/11459029/issue-moving-project-to-visual-studio-2012)

    Will it be fixed by next release ?

    Actually the problem is even more complicated than that because to make it compile I am using projects that have been upgraded from VS2008 to VS2012 and in one of the static library I define the missing symbol like that :

    void __cdecl operator delete(void *,int,char const *,int)
    {
    assert(false);
    }

    Thanks to this ugly hack I manage to compile my project, however I cannot compile it in ARM. So I tried to recreate a VS2012 project from scratch
    but now even with the fix shown above it doesn't compile I still have 2 unresolved external symbol.
    When I compare command lines(without include because they are the same) here is what I see :

    Upgraded project from VS2008 (Compilation SUCCESS):

    /GS /analyze- /W3 /Zc:wchar_t- 
    
    /Zi /Gm- /Od /Fd"Win32\Debug\vc110.pdb" /fp:precise 
    
    /D "_HAS_EXCEPTIONS=0" /D "_DEBUG" /D "DEBUG" /D "_LIB" /D "WINAPI_FAMILY=2" /D "TETRAPHILIA_USE_CUSTOM_SETJMP" /D "_WIN32_WINNT=0x0602" /D "WIN32" /D "WIN_ENV" /D "UFT_ATOM_COMPILE_TIME" /D "UNICODE" /D "_UNICODE" /D "_CRT_SECURE_NO_WARNINGS" /D "_VC80_UPGRADE=0x0710" 
    
    /errorReport:none /WX- /Zc:forScope /RTC1 /GR /Gd /Oy- /MDd /Fa"Win32\Debug\" /nologo /Fo"Win32\Debug\" /Fp"Win32\Debug\xml.pch"
     

    New VS2012 project (Unresolved external symbol delete ...)

    /MP /GS /analyze- /W3 /Zc:wchar_t- 
    
    /ZW:nostdlib /Zi /Gm- /Od /sdl- /Fd"Win32\Debug\vc110.pdb" /fp:precise
    
    /D "_HAS_EXCEPTIONS=0" /D "_DEBUG" /D "DEBUG" /D "_LIB" /D "WINAPI_FAMILY=2" /D "TETRAPHILIA_USE_CUSTOM_SETJMP" /D "_WIN32_WINNT=0x0602" /D "WIN32" /D "WIN_ENV" /D "UFT_ATOM_COMPILE_TIME" /D "UNICODE" /D "_UNICODE" /D "_CRT_SECURE_NO_WARNINGS" /D "WINAPI_FAMILY=WINAPI_FAMILY_APP" 
    
    /errorReport:none /WX- /Zc:forScope /RTC1 /GR /Gd /Oy- /MDd /Fa"Win32\Debug\" /EHsc /nologo /Fo"Win32\Debug\" /Fp"Win32\Debug\xml.pch"


    So except /MP and /ZW:nostdlib /EHSc command line is the same ...

    Update: on my working project when I activate the /EHSc flag I get the same error :

    1>xml.lib(mdom_util.obj) : error LNK2019: unresolved

    external symbol "void __cdecl operator delete[](void *,int,char const *,int)" (??_V@YAXPAXHPBDH@Z) referenced in function __unwindfunclet$??0SourceNodeLine@mdom@@QAE@ABVNode@1@0@Z$2
    1>xml.lib(xpath_term.obj) : error LNK2001: unresolved external symbol "void __cdecl operator delete[](void *,int,char const *,int)" (??_V@YAXPAXHPBDH@Z)
    1>Win32\Debug\RMSDKWrapperCPP.dll : fatal error LNK1120: 1 unresolved externals

    Ok so I have added my hack for the delete[] operator :

    void __cdecl operator delete[](void *,int,char const *,int)
    {
    	assert(false);
    }
    And now it compiles but I hope that kind of hack won't be necessary in the future




    • Edited by Vincent Rich Wednesday, July 18, 2012 1:09 PM
    • Moved by Helen Zhao Thursday, July 19, 2012 6:29 AM (From:Visual C++ General)
    Wednesday, July 18, 2012 9:11 AM

All replies

  • Hello,

     

    Thanks for your feedback, I will involve more experts to investigate it.

     

    Best regards,

    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

    Thursday, July 19, 2012 6:27 AM