Linking error 2005 for std::basic_string

Discussion in 'Visual C++ .Net' started by DN Admin, Apr 25, 2012.

  1. DN Admin

    Staff Member

    Country:
    United States
    Joined:
    Aug 7, 2010
    Location:
    Joliet, IL U.S.A.
    Hi,
    I am upgrading the projects from VS 2003 to VS 2010. I have D1.dll and d1.lib. Similarly D2.dll and D2.lib. These are built using VS 2010. I observed link errors when I try to build D3 project which links with D1 and D2.lib statically. Added the
    name of libs and path on linker settings. All the projects are using /MD switch for Runtime library.Treat WCHAR_T as built in type is set to NO for all projects.
    I am getting follwoing linking error for many functions in std::basic_string<>. (added /verbose option on linker properties)
    Searching C:libreleasesharedD2.lib:<br/>
    Found "__declspec(dllimport) public: __thiscall std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short>
    >::~basic_string <unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >(void)" ( mailto:__imp_??1?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@XZ __imp_??1?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@XZ )<br/>
    Referenced in src2.obj<br/>
    Loaded D2.lib(D2.dll)<br/>
    D2.lib(D2.dll) : error LNK2005 : "public: __thiscall std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short>
    >::~basic_string <unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >(void)" ( mailto:??1?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@XZ ??1?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@XZ )
    already defined in src1.obj <br/>

    I get simliar error for other std::basic_string<> functions.
    Please let me know how can I fix this error? <br/>

    Thanks & regards,<br/>
    P.<br/>



    View the full article
     
    #1

Share This Page