MySql++ in VC++ 6.0

S

sop3k

Hello !!!

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\xlocnum(268) : error
C2587: '_U' : illegal use of local variable as default parameter

D:\KOMPILATORY\C++\Zainstalowane\VC++\INCLUDE\xlocnum(267) : see
declaration
of '_U'

D:\KOMPILATORY\C++\Zainstalowane\VC++\INCLUDE\xlocnum(263) : while
compiling
class-template member function 'class
std::istreambuf_iterator<char,struct
std::char_traits said:
::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.
 
V

Victor Bazarov

sop3k said:
I have a problem during compilation example program from tutorial
about MySql++ 1.7.1
When I want to compile that simple program:

[...]
i gets error like this:

D:\KOMPILATORY\C++\Zainstalowane\VC++\INCLUDE\xlocnum(268) : error ^^^^^^^^^^^^
C2587: '_U' : illegal use of local variable as default parameter
[...]
Whats wrong with this code or my compiler?

It's your compiler. It seems unable to compiles the code that came
with it (unless you have mixed up versions). Please ask further VC++
questions in a VC++ newsgroup: microsoft.public.vc.language. If you
cannot find it on your newsserver, connect to msnews.microsoft.com

V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,228
Latest member
MikeMichal

Latest Threads

Top