List:General Discussion« Previous MessageNext Message »
From:Gerald Clark Date:June 28 2001 1:05pm
Subject:Re: Error during compilation.
View as plain text  
You also need to link in libz, so make it "-lmysqlclient -lz"

mysql novice wrote:

> Hi all,
> 
> I don't know how many times this question has come up
> in discussion, but I am new to the group, so please
> forgive. More over, I am very new to SQL itself.
> 
> I have a small program, that connects to a database,
> and tries to retrieve a part of a table. The program
> is as follows:
> 
> /*
>  * program: connect.c
>  * connect to a test database, and try retrieving some
>  * data.
>  */
> 
> #include <stdio.h>
> #include <stdlib.h>
> #include </usr/local/mysql/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,"localhost","usr1","mysql"))) 
>                 exiterr(1);
>         fprintf(stderr,"Connected to database!\n");
> 
>         if (mysql_select_db(&mysql,"test"))
>                 exiterr(2);
>         fprintf(stderr,"Connected to test
> database!\n");
> 
>         if (mysql_query(&mysql,"SELECT telno,extn FROM
> epabx"))
>                 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]);
>         }
> 
>         mysql_free_result(res);
>         mysql_close(&mysql);
> 
> }
> 
> I compiled the program using a command that I found in
> one of the documents:
> 
> $  gcc -I/usr/local/mysql/include
> -L/usr/local/mysql/lib connect.c -lmysqlclient -o
> connect
> 
> The following error comes:
> /usr/local/mysql/lib/libmysqlclient.a(my_compress.o):
> In function `my_uncompress':
> my_compress.o(.text+0x9a): undefined reference to
> `uncompress'
> /usr/local/mysql/lib/libmysqlclient.a(my_compress.o):
> In function `my_compress_alloc':
> my_compress.o(.text+0x12a): undefined reference to
> `compress'
> collect2: ld returned 1 exit status
> 
> Am I missing anything? Need I download anything? If
> so, where can I get this?
> Please help me.
> Thanks in advance!
> 
> regds,
> Praveen.
> 
> 
> =====
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail
> http://personal.mail.yahoo.com/
> 
> ---------------------------------------------------------------------
> 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 <mysql-thread77913@stripped>
> To unsubscribe, e-mail
> <mysql-unsubscribe-gerald_clark=suppliersystems.com@stripped>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


-- 
Gerald L. Clark
gerald_clark@stripped

Thread
Error during compilation.mysql novice28 Jun
  • Re: Error during compilation.Gerald Clark28 Jun