Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how do I use mysql++ in a VC++ MFC program 1

Status
Not open for further replies.

jcostanz

Programmer
May 24, 2001
36
US
In a counsul program I have no problems.
As soon as I try it in a MFC program I cannot compile.
I get an conflect with the Connection with a dll or lib file
 
can you say, what the error is? John Fill
1c.bmp


ivfmd@mail.md
 
I belive that I have solved the original problem, how I don't know. The error was with mysql++ requiring windows.h and it was conflicting with a MFC include.

I still am having connection exceptions. I cannot catch (BadQuery er), I get a Linker error.

msvcprtd.lib(MSVCP60D.dll) : error LNK2005: &quot;public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)&quot; (??1?$basic_strin
g@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) already defined in mysql++.lib(connection.obj)
 
As i guess, you use STL. In this case remove msvcprtd.lib from linker settings and see results. John Fill
1c.bmp


ivfmd@mail.md
 
I had to remove both msvcprtd.lib and msvcrtd.lib, but then I got

RepDlg.obj : error LNK2001: unresolved external symbol &quot;__declspec(dllimport) public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<
char> >(char const *,class basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::allocator<char> const &)&quot; (__imp_??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBDABV?$allocator@D@1@@Z)
RepDlg.obj : error LNK2001: unresolved external symbol &quot;__declspec(dllimport) public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > & __thiscall std::basic_string<char,struct std::char_traits<char>,class std
::allocator<char> >::eek:perator=(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)&quot; (__imp_??4?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV01@ABV01@@Z)
RepDlg.obj : error LNK2001: unresolved external symbol &quot;__declspec(dllimport) public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<
char> >(char const *,unsigned int,class basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::allocator<char> const &)&quot; (__imp_??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBDIABV?$allocator@D@1@@Z)
RepDlg.obj : error LNK2001: unresolved external symbol &quot;__declspec(dllimport) protected: __thiscall std::basic_ios<char,struct std::char_traits<char> >::basic_ios<char,struct std::char_traits<char> >(void)&quot; (__imp_??0?$basic_ios@DU?$char_traits@D@st
d@@@std@@IAE@XZ)
RepDlg.obj : error LNK2001: unresolved external symbol &quot;__declspec(dllimport) protected: __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::basic_streambuf<char,struct std::char_traits<char> >(void)&quot; (__imp_??0?$basic_streambuf@DU
?$char_traits@D@std@@@std@@IAE@XZ)
RepDlg.obj : error LNK2001: unresolved external symbol &quot;__declspec(dllimport) public: unsigned int __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::length(void)const &quot; (__imp_?length@?$basic_string@DU?$ch
ar_traits@D@std@@V?$allocator@D@2@@std@@QBEIXZ)
RepDlg.obj : error LNK2001: unresolved external symbol &quot;__declspec(dllimport) public: __thiscall std::_Lockit::_Lockit(void)&quot; (__imp_??0_Lockit@std@@QAE@XZ)
RepDlg.obj : error LNK2001: unresolved external symbol &quot;__declspec(dllimport) bool __cdecl std::eek:perator==(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_
traits<char>,class std::allocator<char> > const &)&quot; (__imp_??8std@@YA_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@0@Z)
RepDlg.obj : error LNK2001: unresolved external symbol &quot;__declspec(dllimport) public: char const * __thiscall type_info::name(void)const &quot; (__imp_?name@type_info@@QBEPBDXZ)
RepDlg.obj : error LNK2001: unresolved external symbol &quot;__declspec(dllimport) public: unsigned int __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::size(void)const &quot; (__imp_?size@?$basic_string@DU?$char_t
raits@D@std@@V?$allocator@D@2@@std@@QBEIXZ)
Debug/Quotation Tracker.exe : fatal error LNK1120: 10 unresolved externals

the form uses a tree control, is this causing it?? Thanks

 
Does your MFC project support databases? If so, remove database support. I'll donload the library and will try to see how it works. John Fill
1c.bmp


ivfmd@mail.md
 
The errors were fixed when I recompiled the mysql++ dll with the multithreaded option. Originaly it was single threaded linked.

Thank you for your help
 
Bu the way, I tried what you sayd, but didn't notified any errors. John Fill
1c.bmp


ivfmd@mail.md
 
Where did you get mysql++ I downloaded the one off the website ( and // out the windows.h still get errors everywhere on includes! Anyone know where I can find like a example of how to do this? In a MFC Dialog Based program?

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top