List:MySQL++« Previous MessageNext Message »
From:Rosie Fitzpatrick Date:January 21 2009 9:14pm
Subject:Exceptions in MFC example application in Visual Studio 2008
View as plain text  
Hello list,

First of all, thanks for MySQL++.  It's great.

I recently "upgraded" (I use the term loosely) my project from Visual  
Studio 2003 to Visual Studio 2008.  The library, resetdb, simple1  
examples all compile and the resetdb and simple1 examples work just  
fine in VS 2008.  But when I discovered problems in my project trying  
to iterate over query results (tried multiple different methods), I  
then turned to the MFC example application that came with MySQL++  
3.0.6 to see if that worked.  Much to my disappointment, this program  
does not run properly in VS 2008.  It starts up okay, I enter my  
username and password, then click Connect.  Here is where the problems  

Running this in the Visual Studio debugger, the first problem I had  
with the MFC application was using the Query << operator.  There is an  
unhandled exception:

Unhandled exception at 0x1048c18d (msvcp71d.dll) in mfc.exe:  
0xC0000005: Access violation writing location 0x0041bfc4.

Call stack (relevant bit):
 >	msvcp71d.dll!std::fpos<int>::fpos<int>(long _Off=-1)  Line 37 + 0xd  
bytes	C++
 >::seekoff(long _Off=-1, int _Way=1242056, int _Which=1241640)  Line  
226 + 0xc bytes	C++
short,std::char_traits<unsigned short> >::sputn(const unsigned short *  
_Ptr=0x0012f378, int _Count=4308932)  Line 169	C++
  	mfc.exe!CExampleDlg::OnBnClickedConnectButton()  Line 154 + 0x36  
bytes	C++

So I removed the << operator and put the query string in the query  
initialization [ conn.query("select foo from bar") ], I came across  
another unhandled exception.

Unhandled exception at 0x10023f21 (mysqlpp_d.dll) in mfc.exe:  
0xC0000005: Access violation reading location 0xfeeefeee.

Call stack:

 >	mysqlpp_d.dll! 
 >::operator void const *()  Line 224 + 0x3 bytes	C++
  	mysqlpp_d.dll!mysqlpp::String::data()  Line 158 + 0x8 bytes	C++
  	mysqlpp_d.dll!mysqlpp::String::operator char const *()  Line 533 +  
0x16 bytes	C++
  	mfc.exe!CExampleDlg::OnBnClickedConnectButton()  Line 160 + 0x39  
bytes	C++

Am I nuts for trying to use VS 2008 with this library? Should I go  
back to VS 2003, or 2005 (which I skipped entirely)?

I'm developing on Windows XP SP3 but the product is for a Windows 2003  
server.  I can switch to developing on that OS if it will solve my  
problems.  Any input is much appreciated!

Thanks for your time and consideration.
Exceptions in MFC example application in Visual Studio 2008Rosie Fitzpatrick21 Jan
  • Re: Exceptions in MFC example application in Visual Studio 2008Warren Young21 Jan