List:MySQL++« Previous MessageNext Message »
From:Yigong Liu Date:August 30 2004 3:32pm
Subject:RE: the patch file problems
View as plain text  
For complaints about "cout", add "using namespace std;" at the beginning of your program.

For complaints about "sqlplus.hh", I remember Warren changed it to mysql++.hh, right? You
also need use -I to tell the compiler where to find this header file.

Good luck.


-----Original Message-----
From: Rubén Meré [mailto:bonesmere@stripped] 
Sent: Thursday, August 26, 2004 7:01 AM
To: MySQL++ Mailing List
Subject: Re: the patch file problems


Hello, i erase the all versions of mysql++ to my system, and i downloaded
the lastest version, (1.7.14), and i executed:

rpm -i mysql++-1.7.14-1.rh9.i386.rpm

The execution is free errors.

But i try compile the following code (a simple example from mysql++ manual):

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

int main() {
  Connection con("mysql_cpp_data");
  // The full format for the Connection constructor is
  // Connection(cchar *db, cchar *host="",
  //            cchar *user="", cchar *passwd="")
  // You may need to specify some of them if the database is not on
  // the local machine or you database username is not the same as your
  // login name, etc..

  Query query = con.query();
  // This creates a query object that is bound to con.

  query << "select * from stock";
  // You can write to the query object like you would any other ostrem

  Result res = query.store();
  // Query::store() executes the query and returns the results

  cout << "Query: " << query.preview() << endl;
  // Query::preview() simply returns a string with the current query
  // string in it.

  cout << "Records Found: " << res.size() << endl << endl;

  Row row;
  cout.setf(ios::left);
  cout << setw(17) << "Item"
       << setw(4)  << "Num"
       << setw(7)  << "Weight"
       << setw(7)  << "Price"
       << "Date" << endl
       << endl;

  Result::iterator i;
  // The Result class has a read-only Random Access Iterator
  for (i = res.begin(); i != res.end(); i++) {
    row = *i;
    cout << setw(17) << row[0]
         << setw(4)  << row[1]
         << setw(7)  << row["weight"]
      // you can use either the index number or column name when
      // retrieving the colume data as demonstrated above.
         << setw(7)  << row[3]
         << row[4] << endl;
  }
  return 0;
}

i compiled with command:

gcc ejemysqlpp.cpp -lmysqlpp -o ej

and i take too many errors:

[root@localhost mysql++]# gcc /root/ejemysqlpp.cpp -lmysqlpp -o /root/ej

/root/ejemysqlpp.cpp:3:22: sqlplus.hh: No existe el fichero o el directorio
/root/ejemysqlpp.cpp: En function `int main()':
/root/ejemysqlpp.cpp:6: `Connection' sin declarar (primero use esta función)
/root/ejemysqlpp.cpp:6: (Cada identificador sin declarar es reportado sólo
una
   vez para cada función en el que aparece.)
/root/ejemysqlpp.cpp:6: error de decodificación antes del elemento `('
/root/ejemysqlpp.cpp:14: `Query' sin declarar (primero use esta función)
/root/ejemysqlpp.cpp:17: `query' sin declarar (primero use esta función)
/root/ejemysqlpp.cpp:20: `Result' sin declarar (primero use esta función)
/root/ejemysqlpp.cpp:20: error de decodificación antes del elemento `='
/root/ejemysqlpp.cpp:23: `cout' sin declarar (primero use esta función)
/root/ejemysqlpp.cpp:23: `endl' sin declarar (primero use esta función)
/root/ejemysqlpp.cpp:27: `res' sin declarar (primero use esta función)
/root/ejemysqlpp.cpp:29: `Row' sin declarar (primero use esta función)
/root/ejemysqlpp.cpp:29: error de decodificación antes del elemento `;'
/root/ejemysqlpp.cpp:30: `ios' sin declarar (primero use esta función)
/root/ejemysqlpp.cpp:30: error de decodificación antes del elemento `::'
/root/ejemysqlpp.cpp:31: `setw' sin declarar (primero use esta función)
/root/ejemysqlpp.cpp:38: error de decodificación antes del elemento `::'
/root/ejemysqlpp.cpp:40: `i' sin declarar (primero use esta función)
/root/ejemysqlpp.cpp:41: `row' sin declarar (primero use esta función)

Do you know what´s my problem???



-- 
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe:    http://lists.mysql.com/plusplus?unsub=1



------------------------------------------------------------------------------------------------
This message is for the designated recipient only and may
contain privileged, proprietary, or otherwise private information.  
If you have received it in error, please notify the sender
immediately and delete the original.  Any unauthorized use of
this email is prohibited.
------------------------------------------------------------------------------------------------
[mf2]
Thread
the patch file problemsRubén Meré19 Aug
  • Re: the patch file problemscelliott19 Aug
  • Re: the patch file problemsWarren Young19 Aug
  • Re: the patch file problemsRubén Meré25 Aug
    • Re: the patch file problemsWarren Young25 Aug
  • Re: the patch file problemsRubén Meré30 Aug
    • Re: the patch file problemsWarren Young31 Aug
RE: the patch file problemsYigong Liu30 Aug
  • Re: the patch file problemsWarren Young31 Aug
RE: the patch file problemsRubén Meré1 Sep
  • Re: the patch file problemsWarren Young2 Sep
Re: the patch file problemsRubén Meré3 Sep
  • Re: the patch file problemsWarren Young7 Sep
Re: the patch file problemsWarren Young7 Sep
  • Re: the patch file problemsEarl Miles7 Sep
    • Re: the patch file problemsWarren Young7 Sep
      • Re: the patch file problemsEarl Miles8 Sep