> -----Original Message----- > From: Watter [mailto:[EMAIL PROTECTED] > Sent: den 10 september 2003 17:45 > To: [EMAIL PROTECTED] > Subject: MySQL database help > > > > Dear Sir, > I know your email add. from mysql.com. > If you know how to solve this problem, please teach me. your > reply will be appreciated. > I have copied mysql.h into the folder of /usr/include/mysql/ > but I don't know why the g++(or cc) cannot find the path, > I am using RED HAT8.0, mysql 4.0.14, gcc ver3.2, g++ ver 3.2. > Do I need to change to order version? how to uninstall mysql > 4.0.14? or gcc3.2 from Linux? > 'undefined reference to `mysql_init' means type miss? > > [EMAIL PROTECTED] usr]# g++ -o aa -I/usr/include/mysql/ > -L/usr/lib/mysql/ -lmysqlclient select.c > /tmp/ccCLWgij.o: In function `main': > /tmp/ccCLWgij.o(.text+0x16): undefined reference to `mysql_init' > /tmp/ccCLWgij.o(.text+0x44): undefined reference to `mysql_real_connect' > collect2: ld returned 1 exit status > > [EMAIL PROTECTED] usr]# cc -o aa -I/usr/include/mysql/ > -L/usr/lib/mysql/ -lmysqlclient select.c > /tmp/ccoaFKXF.o: In function `main': > /tmp/ccoaFKXF.o(.text+0x16): undefined reference to `mysql_init' > /tmp/ccoaFKXF.o(.text+0x44): undefined reference to `mysql_real_connect' > collect2: ld returned 1 exit status > [EMAIL PROTECTED] usr]# > > Simple program > =================================================================== > /* > * Simple application using the C API to MySQL > */ > #include <stdio.h> > #include <pwd.h> > #include <stdlib.h> > #include <errno.h> > #include <unistd.h> > #include <sys/types.h> > #include <setjmp.h> > #include <mysql/mysql.h> > #include "getpass.h" > > char *DATABASE="vv"; /* database to use */ > char *HOST="192.168.1.6"; /* database host */ > char *USER="root"; /* user (uses logged in user if NULL) */ > > /* > ------------------------------------------------------------------ > ------------------ */ > int main() > { > > MYSQL *myconnection = mysql_init(NULL); /* > connection block */ > //if(mysql_real_connect(myconnection,"HOST","USER","","DATABASE",3 > 306,NULL,0)!=NULL) > if(mysql_real_connect(myconnection,HOST,USER,"",DATABASE,3306,NULL)) > { > printf("Connection to database '%s' Successfully.\n", > DATABASE); > //printf("%s\n", mysql_error(*myconnection)); > } > else > { > printf("connection failed\n"); > //printf("%s\n", mysql_error(*myconnection)); > } > > > } > > My orig. is Hwagau Database > Best Regards > Watter > > >
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]