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 <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php