I meet a problem when trying to connect MYSQL at MFC Application. The message shows link error, which are:
Generating Code...
Linking...
msvcprtd.lib(MSVCP60D.dll)
: error LNK2005: "public: virtual __thiscall std::basic_ios<char,struct
std::char_traits<char> >::~basic_ios<char,struct std::char_traits<char> >(void)" (??1?$basic_ios@DU?$char_t
raits@D@st
d@@@std@@U
AE@XZ) already defined
in mysql++.lib(sql_query.obj)
msvcprtd.lib(MSVCP60D.dll)
: error LNK2005: "public: __thiscall std::_Lockit::~_Lockit(voi
d)" (??1_Lockit@std@@QAE@XZ) already defined in mysql++.lib(sql_query.obj)
msvcprtd.lib(MSVCP60D.dll)
: error LNK2005: "public: __thiscall std::basic_string<char,str
uct std::char_traits<char>,cla
ss std::allocator<char> >::~basic_string<char,stru
ct std::char_traits<char>,cla
ss std::allocator<char> >(void)" (??1?$basic_strin
g@DU?$char_traits@D@std@@V
?$allocato
r@D@2@@std
@@QAE@XZ) already defined in mysql++.lib(connection.obj
)
msvcprtd.lib(MSVCP60D.dll)
: error LNK2005: "public: virtual __thiscall std::basic_iostream<char,s
truct std::char_traits<char> >::~basic_iostream<char,st
ruct std::char_traits<char> >(void)" (??1?$basic_iostream@DU?$c
har_traits
@D@std@@@s
td@@UAE@XZ
) a
lready defined in mysql++.lib(sql_query.obj)
msvcprtd.lib(MSVCP60D.dll)
: error LNK2005: "public: __thiscall std::basic_iostream<char,s
truct std::char_traits<char> >::basic_iostream<char,str
uct std::char_traits<char> >(class std::basic_streambuf<char,
struct std::char_traits<char> > *)" (??0?$b
asic_iostream@DU?$char_tra
its@D@std@
@@std@@QAE
@PAV?$basi
c_streambu
f@DU?$char
_traits@D@
std@@@1@@Z
) already defined in mysql++.lib(sql_query.obj)
msvcprtd.lib(MSVCP60D.dll)
: error LNK2005: "public: virtual __thiscall std::basic_streambuf<char,
struct std::char_traits<char> >::~basic_streambuf<char,s
truct std::char_traits<char> >(void)" (??1?$basic_streambuf@DU?$
char_trait
s@D@std@@@
std@@UAE@X
Z
) already defined in mysql++.lib(sql_query.obj)
libcp.lib(locale.obj) : error LNK2005: "public: __thiscall std::_Locinfo::_Locinfo(ch
ar const *)" (??0_Locinfo@std@@QAE@PBD@
Z) already defined in msvcprtd.lib(MSVCP60D.dll)
libcp.lib(locale.obj) : error LNK2005: "public: __thiscall std::_Locinfo::~_Locinfo(v
oid)" (??1_Locinfo@std@@QAE@XZ) already defined in msvcprtd.lib(MSVCP60D.dll)
libcp.lib(locale0.obj) : error LNK2005: "public: class std::locale::facet const * __thiscall std::locale::_Getfacet(uns
igned int,bool)const " (?_Getfacet@locale@std@@QB
EPBVfacet@
12@I_N@Z) already defined in msvcprtd.lib(MSVCP60D.dll)
libcp.lib(locale0.obj) : error LNK2005: "public: bool __thiscall std::locale::_Iscloc(void)
const " (?_Iscloc@locale@std@@QBE_
NXZ) already defined in msvcprtd.lib(MSVCP60D.dll)
libcp.lib(locale0.obj) : error LNK2005: "private: static class std::locale::_Locimp * __cdecl std::locale::_Init(void)" (?_Init@locale@std@@CAPAV_
Locimp@12@
XZ) already defined in msvcprtd.lib(MSVCP60D.dll)
libcp.lib(ios.obj) : error LNK2005: "public: void __thiscall std::ios_base::clear(int,b
ool)" (?clear@ios_base@std@@QAEX
H_N@Z) already defined in msvcprtd.lib(MSVCP60D.dll)
libcp.lib(ios.obj) : error LNK2005: "public: virtual __thiscall std::ios_base::~ios_base(v
oid)" (??1ios_base@std@@UAE@XZ) already defined in msvcprtd.lib(MSVCP60D.dll)
libcp.lib(ios.obj) : error LNK2005: "protected: void __thiscall std::ios_base::_Init(void)
" (?_Init@ios_base@std@@IAEX
XZ) already defined in msvcprtd.lib(MSVCP60D.dll)
LIBC.lib(strtol.obj) : error LNK2005: _strtol already defined in msvcrtd.lib(MSVCRTD.dll)
LIBC.lib(crt0dat.obj) : error LNK2005: _exit already defined in msvcrtd.lib(MSVCRTD.dll)
LIBC.lib(crt0dat.obj) : error LNK2005: __exit already defined in msvcrtd.lib(MSVCRTD.dll)
LIBC.lib(strcat.obj) : error LNK2005: _strcpy already defined in msvcrtd.lib(MSVCRTD.dll)
LIBC.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in msvcrtd.lib(cinitexe.obj)
LIBC.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in msvcrtd.lib(cinitexe.obj)
LIBC.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in msvcrtd.lib(cinitexe.obj)
LIBC.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in msvcrtd.lib(cinitexe.obj)
msvcrtd.lib(MSVCRTD.dll) : error LNK2005: __setmbcp already defined in LIBC.lib(mbctype.obj)
LINK : warning LNK4098: defaultlib "msvcrtd.lib" conflicts with use of other libs; use /NODEFAULTLIB:library
LINK : warning LNK4098: defaultlib "LIBC" conflicts with use of other libs; use /NODEFAULTLIB:library
LIBC.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/PDMS_final.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
Creating browse info file...
the .h including codes are :
#include <mysql++.h>
#include <mysql.h>
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdisp.h> // MFC Automation classes
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
I guess mysql++.h includes windows.h that conflicts with afxwin.h, which has to be included at MFC application project. But i do not know how to solve this problem. Could someone help me?