I am currently trying to get de mysql++ api working, I have installed mysql
in /mysql the mysql++api is in /mysql/include/mysql (Needed to change a few
Makefile files and I could not get the examples working so I removed the
dir) but the make install for sqlplusplus was woring perfectly. When I try
to execute a simple script that opens a connection with the db and then
closses it it says Undifined .... mysql_init, mysql_real_connect and
mysql_close. Now to my knowing mysql.h shude solve this problem. To complile
I use the following command:
g++ -I/mysql/include/mysql -L/mysql/libs/mysql -o client.exe client.c
The following file client.c needs to be compiled:
#include <stdio.h>
#include <mysql.h>
//#include <sqlplus.hh>
#define def_host_name "localhost" /* host to connect to (default =
localhost) */
#define def_user_name "mysql" /*user name (default = your login name) */
#define def_password "123456789" /* password (default = none) */
#define def_db_name "database" /*database to use (default = none) */
MYSQL *conn; /* pointer to connection handler */
int main (int argc, char *argv[] )
{
conn = mysql_init(NULL);
mysql_real_connect (
conn, /* pointer to connection handler */
def_host_name, /* host to connect to */
def_user_name, /* user name*/
def_password, /* password */
def_db_name, /* database to use */
0, /* port (use default) */
NULL, /* socket (use default) */
0); /* flags (none) */
mysql_close (conn);
exit(0);
}
What am I doing wrong?
Xavier Wallece
______________________________________________
FREE Personalized Email at Mail.com
Sign up at http://www.mail.com/?sr=signup
______________________________________________
FREE Personalized Email at Mail.com
Sign up at http://www.mail.com/?sr=signup
| Thread |
|---|
| • mysql_connect_db not working during compilation | Xavier Wallece | 18 Jul |