Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

anth-

Strange library conflicts

This topic is 6109 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have recently disembarked on a project involving building in comprehensive SQL support into the Half-Life AdminMod server (among other things). The problem seems to lie in the MySQL api im using (mysql++ - http://www.mysql.com/downloads/api-mysql++.html). I can compile a new lib for the api fine. I can include the api into the adminmod project fine. But, when I try to declare a 'Connection con', it fails to compile, leaving 22 linkage errors which consist entirely of errors involving previously defined definitions: msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: class std::basic_string,class std::allocator > & __thiscall std::basic_string,class std::allocator >::assign(class s td::basic_string,class std::allocator > const &,unsigned int,unsigned int)" (?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@ABV12@II@Z) already defined in libcpmt.lib(ios.obj) msvcprt.lib(MSVCP60.dll) : error LNK2005: "private: void __thiscall std::basic_string,class std::allocator >::_Copy(unsigned int)" (?_Copy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAEXI@Z) already defined in libcpmt.lib(iostream.obj) msvcprt.lib(MSVCP60.dll) : error LNK2005: "private: void __thiscall std::basic_string,class std::allocator >::_Tidy(bool)" (?_Tidy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAEX_N@Z) alread y defined in mysqlfuncs.obj msvcprt.lib(MSVCP60.dll) : error LNK2005: "void __cdecl std::_Xlen(void)" (?_Xlen@std@@YAXXZ) already defined in libcpmt.lib(string.obj) msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: __thiscall std::basic_string,class std::allocator >::~basic_string,class std::allocator >(void)" (??1?$basic_string@ DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) already defined in libcpmt.lib(ios.obj) msvcprt.lib(MSVCP60.dll) : error LNK2005: "private: bool __thiscall std::basic_string,class std::allocator >::_Grow(unsigned int,bool)" (?_Grow@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAE _NI_N@Z) already defined in libcpmt.lib(iostream.obj) msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: class std::basic_string,class std::allocator > & __thiscall std::basic_string,class std::allocator >::erase(unsigned int,unsigned int)" (?erase@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@II@Z) already defined in libcpmt.lib(iostream.obj) msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: __thiscall std::ios_base::Init::Init(void)" (??0Init@ios_base@std@@QAE@XZ) already defined in libcpmt.lib(iostream.obj) msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: __thiscall std::ios_base::Init::~Init(void)" (??1Init@ios_base@std@@QAE@XZ) already defined in libcpmt.lib(iostream.obj) msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: __thiscall std::_Winit::_Winit(void)" (??0_Winit@std@@QAE@XZ) already defined in libcpmt.lib(wiostrea.obj) msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: __thiscall std::_Winit::~_Winit(void)" (??1_Winit@std@@QAE@XZ) already defined in libcpmt.lib(wiostrea.obj) msvcprt.lib(MSVCP60.dll) : error LNK2005: "private: void __thiscall std::basic_string,class std::allocator >::_Split(void)" (?_Split@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAEXXZ) alread y defined in libcpmt.lib(iostream.obj) msvcprt.lib(MSVCP60.dll) : error LNK2005: "void __cdecl std::_Xran(void)" (?_Xran@std@@YAXXZ) already defined in libcpmt.lib(string.obj) msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: class std::basic_string,class std::allocator > & __thiscall std::basic_string,class std::allocator >::assign(char co nst *,unsigned int)" (?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@PBDI@Z) already defined in libcpmt.lib(iostream.obj) msvcprt.lib(MSVCP60.dll) : error LNK2005: "private: void __thiscall std::basic_string,class std::allocator >::_Freeze(void)" (?_Freeze@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAEXXZ) alre ady defined in libcpmt.lib(iostream.obj) msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: __thiscall std::_Lockit::~_Lockit(void)" (??1_Lockit@std@@QAE@XZ) already defined in libcpmt.lib(xlock.obj) msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: __thiscall std::_Lockit::_Lockit(void)" (??0_Lockit@std@@QAE@XZ) already defined in libcpmt.lib(xlock.obj) MSVCRT.lib(MSVCRT.dll) : error LNK2005: _memmove already defined in LIBCMT.lib(memmove.obj) MSVCRT.lib(MSVCRT.dll) : error LNK2005: _tolower already defined in LIBCMT.lib(tolower.obj) MSVCRT.lib(MSVCRT.dll) : error LNK2005: "public: int __thiscall type_info::operator==(class type_info const &)const " (??8type_info@@QBEHABV0@@Z) already defined in LIBCMT.lib(typinfo.obj) MSVCRT.lib(MSVCRT.dll) : error LNK2005: "public: int __thiscall type_info::before(class type_info const &)const " (?before@type_info@@QBEHABV1@@Z) already defined in LIBCMT.lib(typinfo.obj) The four conflicting libraries are msvcprt.lib with libcpmt.lib, and msvcrt.lib with libcmt.lib. Now, if i add the following lines to the compiler directives: /nodefaultlib:"msvcrt" /nodefaultlib:"libcpmt" I can compile with 'Connection con' somewhere inside my project, and it works fine with no runtime errors. If I compile without, I get 45 errors, all of which involve std::ios_base and std::_Winit. Now, if I try to add "Query query = con.query();" it gives 4 errors: msvcprt.lib(MSVCP60.dll) : error LNK2005: "private: void __thiscall std::basic_string,class std::allocator >::_Tidy(bool)" (?_Tidy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAEX_N@Z) alread y defined in mysqlfuncs.obj mysqlfuncs.obj : error LNK2001: unresolved external symbol "private: static class std::locale::_Locimp * std::locale::_Locimp::_Global" (?_Global@_Locimp@locale@std@@0PAV123@A) mysqlfuncs.obj : error LNK2001: unresolved external symbol "__int64 const std::_Fpz" (?_Fpz@std@@3_JB) .\ReleaseMM\admin_MM.dll : fatal error LNK1120: 2 unresolved externals If i do not assign con.query() to query (which I must do in order to use it) it compiles the same as if I had no 'Query query;'. I suspect the msvc compiler is mistaking inheritance declarations inside the mysql++ api for pure declarations, or something to that effect. Is there any way I can force it to realize that mysql++ is not defining these? Or if thats not the problem, tell me what im doing wrong? Perhaps someone can even provide me with a less bloated mysql api. Thanks in advance. Edited by - anth- on December 29, 2001 12:26:16 AM

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!