mysql++ for msVC++: Problems

Started by
23 comments, last by emileej 20 years, 5 months ago
I first attempted to direct this question to the developer of the api, but my mail returned an "undeliverable" message. The api in question is the mysql++ api for MS VC++6.0 from www.mysql.com I followed every instruction in the readme and went over it again and again, but no luck so far. My only hope is that someone in here have used the api successfully and can point me in the right direction. This is the errors I get:

--------------------Configuration: scms - Win32 Debug--------------------
Linking...
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 scms.obj
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 libcpd.lib(ios.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 scms.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 libcpd.lib(iostream.obj)
msvcprt.lib(MSVCP60.dll) : error LNK2005: "void __cdecl std::_Xlen(void)" (?_Xlen@std@@YAXXZ) already defined in libcpd.lib(string.obj)
msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: __thiscall std::ios_base::Init::Init(void)" (??0Init@ios_base@std@@QAE@XZ) already defined in libcpd.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 libcpd.lib(iostream.obj)
msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: __thiscall std::_Winit::_Winit(void)" (??0_Winit@std@@QAE@XZ) already defined in libcpd.lib(wiostrea.obj)
msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: __thiscall std::_Winit::~_Winit(void)" (??1_Winit@std@@QAE@XZ) already defined in libcpd.lib(wiostrea.obj)
msvcprt.lib(MSVCP60.dll) : error LNK2005: "private: void __thiscall std::basic_string,class std::allocator >::_Eos(unsigned int)" (?_Eos@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAEXI@Z) a
lready defined in libcpd.lib(iostream.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 libcpd.lib(iostream.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 libcpd.lib(iostream.obj)
msvcprt.lib(MSVCP60.dll) : error LNK2005: "void __cdecl std::_Xran(void)" (?_Xran@std@@YAXXZ) already defined in libcpd.lib(string.obj)
msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: __thiscall std::basic_string,class std::allocator >::basic_string,class std::allocator >(class basic_string,class std::allocator >::basic_string,class std::allocator > const &)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z) already defined in libcpd.
lib(ios.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 libcpd.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 libcpd.lib(iostream.obj)
msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: char const * __thiscall std::basic_string,class std::allocator >::c_str(void)const " (?c_str@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBE
PBDXZ) already defined in libcpd.lib(ios.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 libcpd.lib(iostream.obj)
msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: __thiscall std::_Lockit::~_Lockit(void)" (??1_Lockit@std@@QAE@XZ) already defined in scms.obj
msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: __thiscall std::_Lockit::_Lockit(void)" (??0_Lockit@std@@QAE@XZ) already defined in scms.obj
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _memmove already defined in LIBCD.lib(memmove.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 LIBCD.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 LIBCD.lib(typinfo.obj)
LINK : warning LNK4098: defaultlib "MSVCRT" conflicts with use of other libs; use /NODEFAULTLIB:library
Debug/scms.exe : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.

scms.exe - 24 error(s), 1 warning(s)
 
------------- E-)mil "I feel like... I feel like... Like taking over the world!" - Day of the Tentacle
Emil Johansen- SMMOG AI designerhttp://smmog.com
Advertisement
Did you link with the multithreaded dll runtime?

C runtime I mean

From working a bit with mysql++, I suggest you use the /NODEFAULTLIB:library switch on the libs it complains about. It doesn''t play well with STLPort either, so use MSVC++''s STL implementation.
>>Maega
Whats the name of that dll?
>>CWizard
Where do I set that option?
Emil Johansen- SMMOG AI designerhttp://smmog.com
quote:Original post by emileej
>>Maega
Whats the name of that dll?

Project->Settings->C/C++ (Category: Code Generation)->Use run-time library:

Set the "Multi-threaded DLL" for your release version, and "Debug Multi-threaded DLL" for your debug version.
quote:>>CWizard
Where do I set that option?
Project->Settings->Link (Category: General)->Project Options:

Add to the end of the list "/NODEFAULTLIB:msvcprt.lib /NODEFAULTLIB:MSVCRT.lib"
Now I get the following errors in stead:


--------------------Configuration: scms - Win32 Debug--------------------
Linking...
LINK : warning LNK4049: locally defined symbol ""public: __thiscall std::basic_string,class std::allocator >::~basic_string,class std::allocator >(void)" (??1?$basic_s
tring@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ)" imported
LINK : warning LNK4049: locally defined symbol ""public: class std::basic_string,class std::allocator > & __thiscall std::basic_string,class std::allocator >::assign(c
lass std::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)" imported
LINK : warning LNK4049: locally defined symbol ""public: static unsigned int const std::basic_string,class std::allocator >::npos" (?npos@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@2IB)" im
ported
LINK : warning LNK4049: locally defined symbol ""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)"
imported
LINK : warning LNK4049: locally defined symbol ""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@@AA
EXI@Z)" imported
LINK : warning LNK4049: locally defined symbol ""void __cdecl std::_Xlen(void)" (?_Xlen@std@@YAXXZ)" imported
LINK : warning LNK4049: locally defined symbol ""char const `private: static char const * __cdecl std::basic_string,class std::allocator >::_Nullstr(void)''::`2''::_C" (?_C@?1??_Nullstr@?$basic_string@DU?$char
_traits@D@std@@V?$allocator@D@2@@std@@CAPBDXZ@4DB)" imported
LINK : warning LNK4049: locally defined symbol ""public: __thiscall std::ios_base::Init::Init(void)" (??0Init@ios_base@std@@QAE@XZ)" imported
LINK : warning LNK4049: locally defined symbol ""public: __thiscall std::ios_base::Init::~Init(void)" (??1Init@ios_base@std@@QAE@XZ)" imported
LINK : warning LNK4049: locally defined symbol ""public: __thiscall std::_Winit::_Winit(void)" (??0_Winit@std@@QAE@XZ)" imported
LINK : warning LNK4049: locally defined symbol ""public: __thiscall std::_Winit::~_Winit(void)" (??1_Winit@std@@QAE@XZ)" imported
LINK : warning LNK4049: locally defined symbol ""private: void __thiscall std::basic_string,class std::allocator >::_Eos(unsigned int)" (?_Eos@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAEX
I@Z)" imported
LINK : warning LNK4049: locally defined symbol ""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@@st
d@@AAE_NI_N@Z)" imported
LINK : warning LNK4049: locally defined symbol "_memmove" imported
LINK : warning LNK4049: locally defined symbol ""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)"
imported
LINK : warning LNK4049: locally defined symbol ""void __cdecl std::_Xran(void)" (?_Xran@std@@YAXXZ)" imported
LINK : warning LNK4049: locally defined symbol ""public: __thiscall std::basic_string,class std::allocator >::basic_string,class std::allocator >(class basic_stringar,struct std::char_traits,class std::allocator >::basic_string,class std::allocator > const &)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z)" imported
LINK : warning LNK4049: locally defined symbol ""public: class std::basic_string,class std::allocator > & __thiscall std::basic_string,class std::allocator >::assign(c
har const *,unsigned int)" (?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@PBDI@Z)" imported
LINK : warning LNK4049: locally defined symbol ""public: class std::basic_string,class std::allocator > & __thiscall std::basic_string,class std::allocator >::erase(un
signed int,unsigned int)" (?erase@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@II@Z)" imported
LINK : warning LNK4049: locally defined symbol ""public: char const * __thiscall std::basic_string,class std::allocator >::c_str(void)const " (?c_str@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@st
d@@QBEPBDXZ)" imported
LINK : warning LNK4049: locally defined symbol ""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
)" imported
LINK : warning LNK4049: locally defined symbol ""public: __thiscall std::_Lockit::~_Lockit(void)" (??1_Lockit@std@@QAE@XZ)" imported
LINK : warning LNK4049: locally defined symbol ""public: __thiscall std::_Lockit::_Lockit(void)" (??0_Lockit@std@@QAE@XZ)" imported
LINK : warning LNK4049: locally defined symbol ""public: int __thiscall type_info::operator==(class type_info const &)const " (??8type_info@@QBEHABV0@@Z)" imported
LINK : warning LNK4049: locally defined symbol ""public: int __thiscall type_info::before(class type_info const &)const " (?before@type_info@@QBEHABV1@@Z)" imported
mysql++.lib(connection.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::basic_string,class std::allocator >::basic_string,clas
s std::allocator >(class basic_string,class std::allocator >::allocator const &)" (__imp_??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV?$allocator@D@1@@Z)
mysql++.lib(field_names.obj) : error LNK2001: unresolved external symbol __imp__tolower
mysql++.lib(field_names.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: char & __thiscall std::basic_string,class std::allocator >::operator[](unsigned int)" (__imp_??A?$basic_
string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAADI@Z)
Debug/scms.exe : fatal error LNK1120: 3 unresolved externals
Error executing link.exe.

scms.exe - 4 error(s), 25 warning(s)
Emil Johansen- SMMOG AI designerhttp://smmog.com
Yeah, I know the hell...

A couple of suggestions/questions:
- Make sure you are using MSVC++'s STL, not eg. STLPort
- Have you updated MSVC++'s headers? Do you have the latest SDK and MSVC Service Pack (5 is the latest I think)?
- You will have to live with the warnings.
- If you just want simple MySQL access, consider using the plain C API or using another language than C/C++.

[edited by - CWizard on October 25, 2003 4:34:47 PM]
There is a non-customised version of the api? Arrrrgggghhh! Ill get on it first thing in the mornin.
Emil Johansen- SMMOG AI designerhttp://smmog.com
quote:Original post by emileej
There is a non-customised version of the api? Arrrrgggghhh! Ill get on it first thing in the mornin.
Yes, Mysql++ is just an wrapper over the libmysql library. The only nice thing about it under normal circumstances is the automatic type conversions.

I downloaded the source distribution, added the path to the "sqlplusint" to my list of additional include directories and as the online example does I included .
When I try to compile I get this:

--------------------Configuration: scms - Win32 Debug--------------------
Compiling...
scms.cpp
c:\programmering\cpp\mysql\sqlplusint\defs(5) : fatal error C1083: Cannot open include file: ''mysql.h'': No such file or directory
Error executing cl.exe.

scms.exe - 1 error(s), 0 warning(s)

I have searched all the directories of the download and I cannot find mysql.h anywhere. Did I get the wrong download or am I perhaps doing something else wrong?

-------------
E-)mil
"I feel like... I feel like...
Like taking over the world!"
- Day of the Tentacle
Emil Johansen- SMMOG AI designerhttp://smmog.com

This topic is closed to new replies.

Advertisement