newbie : Help with C api for mysql

2002-03-18 Thread jim and lois flaherty

I have a Redhat 7.1 box, I want it to connect to its own mysql db . Here is
my code


#include stdio.h;
#include mysql.h;

int main(char **args){

   MYSQL_RES *result;
   MYSQL_ROW row;
   MYSQL *connection, mysql;

   int state;


/*  connect to the mysql db  */

mysql_init(mysql);

connection =
mysql_real_connect(mysql,localhost,root,password,cram,3306,0, 0);


/* check for connection error */






###
it doent compile right , I get




 gcc analysis.c



analysis.c:6:19: warning: extra tokens at end of #include directive
analysis.c:7:19: warning: extra tokens at end of #include directive
/tmp/ccsKk2GG.o: In function `main':
/tmp/ccsKk2GG.o(.text+0x14): undefined reference to `mysql_init'
/tmp/ccsKk2GG.o(.text+0x40): undefined reference to `mysql_real_connect'
collect2: ld returned 1 exit status


What Am I doing Wrong ??


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail mysql-unsubscribe-##L=##[EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: newbie : Help with C api for mysql

2002-03-18 Thread Sammy Lau

jim and lois flaherty wrote:
  gcc analysis.c
 
 analysis.c:6:19: warning: extra tokens at end of #include directive
 analysis.c:7:19: warning: extra tokens at end of #include directive
 /tmp/ccsKk2GG.o: In function `main':
 /tmp/ccsKk2GG.o(.text+0x14): undefined reference to `mysql_init'
 /tmp/ccsKk2GG.o(.text+0x40): undefined reference to `mysql_real_connect'
 collect2: ld returned 1 exit status
 
 What Am I doing Wrong ??
 

you need -lmysqlclient.

check http://www.mysql.com/doc/C/C/C.html for more details.

-- 
Sammy Lau
mailto: [EMAIL PROTECTED]
- Tell me what you want and I'll tell you how you can live without it.

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php