It means you forgot -lz.
You also need libz.so

Evan James Dembskey wrote:
> 
> Hi,
> 
> While trying to compile a program in C taken from the book Professional
> Linux Programming (Matthew, N. & Stones, R. (2000) 155) using this command
> (also taken from the same book):
> 
>         [root@evan /usr]# gcc -I/usr/include/mysql
> connect1.c -L/usr/lib/mysql -lmysqlclient -o connect1
> 
> I get the following error. What does this mean, and how can I fix it?
> 
>         /usr/lib/mysql/libmysqlclient.a(my_compress.o): In function
> `my_uncompress':
>         my_compress.o(.text+0x97): undefined reference to `uncompress'
>         /usr/lib/mysql/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
>         [root@evan /usr]#
> 
> I am running under Mandrake 7.2.
> 
> Program
> -------
> 
> #include <stdlib.h>
> #include <stdio.h>
> 
> #include "mysql.h"
> 
> int main(int argc, char *argv[])
> {
>   MYSQL my_connection;
> 
>   mysql_init(&my_connection);
>   if(mysql_real_connect(&my_connection,
> "localhost","root","","test",0,NULL,0)){
>     printf("Connection success\n");
>     mysql_close(&my_connection);}
>     else{
>     fprintf(stderr, "Connection failed\n");
>     if (mysql_errno(&my_connection)){
>       fprintf(stderr, "Connection error %d: %s\n",
> mysql_errno(&my_connection),
>         mysql_error(&my_connection));
> }
> }
> 
> return EXIT_SUCCESS;
> 
> }
> 
> Regards,
> 
> Evan
> 
> ---------------------------------------------------------------------
> 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

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