I have a problem during compilation example program from tutorial
about MySql++ 1.7.1
When I want to compile that simple program:
#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 {
Connection con (use_exceptions);
con.connect ("mysql_cpp_data");
Query query = con.query ();
query << "select * from stock";
vector < stock > res;
query.storein (res);
cout.precision(3);
vector <stock>::iterator i;
for (i = res.begin (); i != res.end (); i++) {
cout << setw (17) << i->item.c_str ()
<< setw (4) << i->num
<< setw (7) << i->weight
<< setw (7) << i->price
<< i->sdate
<< endl;
}
return 0;
} catch (BadQuery er){
cerr << "Error: " << er.error << endl;
return -1;
} catch (BadConversion er) {
cerr << "Error: Tried to convert \"" << er.data << "\" to a \""
<< er.type_name << "\"." << endl;
return -1;
}
}
i gets error like this:
D:\KOMPILATORY\C++\Zainstalowane\VC++\INCLUDE\xloc num(268) : error
C2587: '_U' : illegal use of local variable as default parameter
D:\KOMPILATORY\C++\Zainstalowane\VC++\INCLUDE\xloc num(267) : see
declaration
of '_U'
D:\KOMPILATORY\C++\Zainstalowane\VC++\INCLUDE\xloc num(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_iterator<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'
But when I throw out the line
query.storein (res);
Everything is going fine.
Whats wrong with this code or my compiler?
Thanks.