well maybe I am just confused but I think that that function is in the libc
library, but then again I found it in the static library ie libc.a...

Why am I confused... I thought that it should have been included by default
or am I wrong, but I guess this is a question for a different NewsGroup...

Barry

-----Original Message-----
From: Jérémy Cluzel [mailto:[EMAIL PROTECTED]]
Sent: 28 February 2001 01:01
To: MySql List
Subject: Error comiling with C Api


Hi,

I need help on compiling with the C APIs.

mysql v3.22.30
glibc-2.1.2-11

source code:

#include <stdio.h>
#include <stdlib.h>
#include <mysql.h>

MYSQL mysql;
MYSQL_RES *res;
MYSQL_ROW row;

void exiterr(int exitcode){
 fprintf( stderr, "%s\n", mysql_error(&mysql) );
  exit( exitcode );
}

int main(){
  uint i = 0;
  if (!(mysql_connect(&mysql,"host","username","password")))
    exiterr(1);
  if (mysql_select_db(&mysql,"payroll"))
    exiterr(2);
  if (mysql_query(&mysql,"SELECT name,rate FROM emp_master"))
    exiterr(3);
  if (!(res = mysql_store_result(&mysql)))
    exiterr(4);
  while((row = mysql_fetch_row(res)))
    for (i=0 ; i < mysql_num_fields(res); i++)
       printf("%s\n",row[i]);
  if (!mysql_eof(res))
    exiterr(5);
  mysql_free_result(res);
  mysql_close(&mysql);
}

link command:
gcc -o test test.c -L/usr/lib/mysql -lmysqlclient

outcome:
/usr/lib/mysql/libmysqlclient.a(my_open.o): In function `my_open':
my_open.o(.text+0x14): undefined reference to `open64'
/usr/lib/mysql/libmysqlclient.a(mf_format.o): In function `fn_format':
mf_format.o(.text+0x208): undefined reference to `__lxstat64'
/usr/lib/mysql/libmysqlclient.a(my_fopen.o): In function `my_fopen':
my_fopen.o(.text+0x21): undefined reference to `fopen64'
collect2: ld returned 1 exit status

what's wrong with it ? where i can find these references ?

Thanks for your help

Regards

Jeremy Cluzel

---------------------------------------------------------------------
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

Reply via email to