kenneth johansen writes:
> hello everybody.
> Ive been working with perl and mysql for some time, but recently i had
> to move over
> to C and as such i wrote a small test program, just to get to know the
> mysql C API.
> Well, things didnt go as i thought. i kept getting linking problems
> and in the end my test program was limited to the few lines bellow:
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> #include <stdlib.h>
> #include "mysql.h"
> #include <unistd.h>
> #include <stdio.h>
> 
> int main(){
> 
>   MYSQL *mysql;
> 
> mysql = mysql_init(NULL);
>   if (mysql == NULL) {
>     fprintf(stderr,"mysql_init() failed (foobar\n");
>     exit(1);
>   }
> }
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 
> i compile this with:
> gcc -I/usr/local/mysql/include/ -L/usr/local/mysql/lib/ program.c
> -lmysqlclient
> 
> but i always get the error message:
> /usr/local/mysql/lib//libmysqlclient.a(my_compress.o): In function
> `my_uncompress':
> my_compress.o(.text+0x97): undefined reference to `uncompress'
> /usr/local/mysql/lib//libmysqlclient.a(my_compress.o): In function
> `my_compress_alloc':
> my_compress.o(.text+0x12b): undefined reference to `compress'
> collect2: ld returned 1 exit status
> 
> doing an nm on libmysqlclient.a does reveal that the compress functions
> are there,but
> for some reason it wont work.
> 
> appriciate any/all help
> 
> regards
> [EMAIL PROTECTED]
> 


Just add -lz to linker command.


Regards,

Sinisa

      ____  __     _____   _____  ___     ==  MySQL AB
     /*/\*\/\*\   /*/ \*\ /*/ \*\ |*|     Sinisa Milivojevic
    /*/ /*/ /*/   \*\_   |*|   |*||*|     mailto:[EMAIL PROTECTED]
   /*/ /*/ /*/\*\/*/  \*\|*|   |*||*|     Larnaca, Cyprus
  /*/     /*/  /*/\*\_/*/ \*\_/*/ |*|____
  ^^^^^^^^^^^^/*/^^^^^^^^^^^\*\^^^^^^^^^^^
             /*/             \*\                Developers Team

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