LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   c++ and mysql api (https://www.linuxquestions.org/questions/programming-9/c-and-mysql-api-52149/)

nakkaya 03-28-2003 02:11 AM

c++ and mysql api
 
i am using redhat 8.0 and installed MySQL++ 1.7.9 RPM for Red Hat 8.0 with gcc 3.2 installation went fine.when i tried to compile the following code

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

int main()
{
Connection con("mysql_cpp_data");

Query query=con.query();
query<<"select * from stock";
Result res =query.store();

cout<<"query: "<,query.preview()<<endl;
cout<<"Records found: "<<res.size()<<endl<<endl;

Row row;
cout.setf(iso::left);
cout<<setw(17)<<"item"
<<setw(4)<<"Num"
<<setw(7)<<"weith"
<<setw(7)<<"price"
<<"date"<<endl
<<endl;

Result::iterator i;

for(i=res.begin();i!=res.end();i++){
row = *i;
cout<<setw(17)<<row[0]
<<setw(4)<<row[1]
<<setw(7)<<row["weight"]
<<setw(7)<<row[3]
<<row[4]<<endl;
}
return 0;
}

i got a lot of errors 20 pages or so first one is mysql.h is not found what other thing i have to install to use the api

Hko 03-28-2003 04:13 AM

Re: c++ and mysql api
 
Quote:

Originally posted by nakkaya
i got a lot of errors 20 pages or so first one is mysql.h is not found what other thing i have to install to use the api [/B]
Sounds like you have the MySQL API installed, but not its header-files. Often header-files are in an extra package.

I don't know much about RedHat, but the rpm package your are looking for is probably calles something like:

mysql-devel-xx.xx.rpm or mysql-dev-xx.xx.rpm

nakkaya 03-28-2003 04:39 AM

i copied all include file from /mysql and /sqlplus to /usr/include but now i get another eror
undifined reference mysqlconnection
and alot of other things why?

Hko 03-28-2003 09:14 AM

Make sure the linker knows where the (shared) libs of the MySQL API are.
"/mysql" is a bit of weird place to have installed. Myabe you should try to reinstall it from rpm packages, along with the devel/dev package.

nakkaya 03-28-2003 11:10 PM

i installed all the devel packages


All times are GMT -5. The time now is 03:31 AM.