LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 03-28-2003, 03:11 AM   #1
nakkaya
Guru
 
Registered: Jan 2003
Location: Turkey&USA
Distribution: Emacs and linux is its device driver(Slackware,redhat)
Posts: 1,398

Rep: Reputation: 45
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
 
Old 03-28-2003, 05:13 AM   #2
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: ubuntu
Posts: 2,530

Rep: Reputation: 108Reputation: 108
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
 
Old 03-28-2003, 05:39 AM   #3
nakkaya
Guru
 
Registered: Jan 2003
Location: Turkey&USA
Distribution: Emacs and linux is its device driver(Slackware,redhat)
Posts: 1,398

Original Poster
Rep: Reputation: 45
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?
 
Old 03-28-2003, 10:14 AM   #4
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: ubuntu
Posts: 2,530

Rep: Reputation: 108Reputation: 108
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.
 
Old 03-29-2003, 12:10 AM   #5
nakkaya
Guru
 
Registered: Jan 2003
Location: Turkey&USA
Distribution: Emacs and linux is its device driver(Slackware,redhat)
Posts: 1,398

Original Poster
Rep: Reputation: 45
i installed all the devel packages
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
MySQL Client API I_AM Linux - Newbie 1 06-27-2005 03:52 AM
mysql client api I_AM Linux - Newbie 1 06-24-2005 12:48 AM
linking C api for mysql toships Programming 3 04-09-2004 12:29 AM
msql++ c++ api for mysql nakkaya Linux - Software 0 04-19-2003 04:56 PM
mySQL and C API Problems [RJP]DeanLO Programming 1 11-15-2001 10:16 PM


All times are GMT -5. The time now is 11:30 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration