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 ("myfirst"
Query query = con.query ();
query << "select * from stock";
std::vector <stock> res;
query.storein (res);
return 0;
} catch (BadQuery er){ // handle any connection
// or query errors that may come up
cerr << "Error: " << 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 << "Error: Tried to convert \"" << er.data << "\" to a \""
<< er.type_name << "\"." << 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.
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 ("myfirst"
Query query = con.query ();
query << "select * from stock";
std::vector <stock> res;
query.storein (res);
return 0;
} catch (BadQuery er){ // handle any connection
// or query errors that may come up
cerr << "Error: " << 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 << "Error: Tried to convert \"" << er.data << "\" to a \""
<< er.type_name << "\"." << 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.