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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mysql++ with Visual C++ compile error

Status
Not open for further replies.

venkman

Programmer
Oct 9, 2001
467
US
I keep getting a compile error when trying to compile one of the examples that came with the mysql++ api in Visual C++ 6.0 (sp 5) on Windows XP. The example is custom1.cpp. The error seems to be caused by the line:

query.storein (res);

where query is a Query object, res is a vector<stock>, and stock is structure created by the sql_create_5 macro. when I comment out this line, the file compiles without any problems.

compile errors all come from the file xlocnum which I believe is included with Visual Studio 6.0 .

Please let me know if you know what's causing this.

Here's a copy of the code and compile errors:

code:


#include <iostream>
#include <iomanip>
#include <vector>
#include <sqlplus.hh>
#include <custom.hh>


sql_create_5 (stock, 1, 5, string, item, int, num,
double, weight, double, price, Date, sdate)


int main() {
try { // its in one big try block

Connection con (use_exceptions);
con.connect (&quot;myfirst&quot;);
Query query = con.query ();
query << &quot;select * from stock&quot;;

std::vector <stock> res;
query.storein (res);
return 0;

} catch (BadQuery er){ // handle any connection
// or query errors that may come up
cerr << &quot;Error: &quot; << er.error << endl;
return -1;

} catch (BadConversion er) {
// we still need to cache bad conversions incase something goes
// wrong when the data is converted into stock
cerr << &quot;Error: Tried to convert \&quot;&quot; << er.data << &quot;\&quot; to a \&quot;&quot;
<< er.type_name << &quot;\&quot;.&quot; << endl;
return -1;
}
}

**************
Here's copy of the first couple of errors:

--------------------Configuration: examples - Win32 Debug--------------------
Compiling...
custom1my.cpp
c:\program files\microsoft visual studio\vc98\include\xlocnum(268) : error C2587: '_U' : illegal use of local variable as default parameter
c:\program files\microsoft visual studio\vc98\include\xlocnum(267) : see declaration of '_U'
c:\program files\microsoft visual studio\vc98\include\xlocnum(263) : while compiling class-template member function 'class std::istreambuf_iterator<char,struct std::char_traits<char> > __thiscall std::num_get<char,class std::istreambuf_itera
tor<char,struct std::char_traits<char> > >::do_get(class std::istreambuf_iterator<char,struct std::char_traits<char> >,class std::istreambuf_iterator<char,struct std::char_traits<char> >,class std::ios_base &,int &,void *& ) const'
c:\program files\microsoft visual studio\vc98\include\xlocnum(268) : error C2228: left of '._Lo' must have class/struct/union type
c:\program files\microsoft visual studio\vc98\include\xlocnum(263) : while compiling class-template member function 'class std::istreambuf_iterator<char,struct std::char_traits<char> > __thiscall std::num_get<char,class std::istreambuf_itera
tor<char,struct std::char_traits<char> > >::do_get(class std::istreambuf_iterator<char,struct std::char_traits<char> >,class std::istreambuf_iterator<char,struct std::char_traits<char> >,class std::ios_base &,int &,void *& ) const'

*********
Thanks for any help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top