Jump to content

Linking error 2005 for std::basic_string

- - - - -

  • Please log in to reply
No replies to this topic

#1
AWS

AWS

    Administrator

  • Administrators
  • 54142 posts
  • LocationJoliet, 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:
        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)" (__imp_??1?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@XZ)
  Referenced in src2.obj
Loaded D2.lib(D2.dll)
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)" (??1?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@XZ) already defined in src1.obj

I get simliar error for other std::basic_string<> functions.

Please let me know how can I fix this error?

Thanks & regards,
P.


View the full article




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users