Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

Re: linking problem: my_compress.o undefined: msg#00009

db.mysql.c++

Subject: Re: linking problem: my_compress.o undefined

Luke Budnik wrote:
Hello.

I've downloaded some(all except shared-compat) rpms for my Linux from
www.mysql.com.
I've got simple C code connecting to database test and reading records from
table TEST.

Compilation is OK but durning linking porcess i recieve strange errors
like:
/usr/lib/mysql/libmysqlclient.a(my_compress.o)(.text+0xbc): In function
`my_compress_alloc':
: undefined reference to `compress'
/usr/lib/mysql/libmysqlclient.a(my_compress.o)(.text+0x13a): In function
`my_uncompress':
: undefined reference to `uncompress'
collect2: ld returned 1 exit status

i'm compiling my prog.c with gcc:
gcc prog.c -L/usr/lib/mysql -I/usr/include/mysql -lmysqlclient

do i need to include sth else, new library?

I've installed all new rpms from www.mysql.com.

what do i do wrong?

thanks in advance
greetings R

here the code i'm trying to compile:

#include <sys/time.h>
#include <stdio.h>
#include <mysql.h>

int main(char **args) {

MYSQL_RES *result;
MYSQL_ROW row;
MYSQL *connection, mysql;
int state;

mysql_init(&mysql);

connection = mysql_real_connect(&mysql,
"amd",
0, 0,0,MYSQL_PORT,
"test", 0);


if( connection == NULL ) {
printf(mysql_error(&mysql));
return 1;
}

state = mysql_query(connection,
"SELECT * FROM TEST");

if( state != 0 ) {
printf(mysql_error(connection));
return 1;
}

result = mysql_store_result(connection);

printf("Rows: %d\n", mysql_num_rows(result));

while( ( row = mysql_fetch_row(result)) != NULL ) {
printf("id: %s, val: %s\n",
(row[0] ? row[0] : "NULL"),
(row[1] ? row[1] : "NULL"));
}

mysql_free_result(result);
mysql_close(connection);

printf("Done.\n");
}




All you have to do is link in zlib library with -lz

--

Sincerely,

--
For technical support contracts, go to https://order.mysql.com/?ref=msmi
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Mr. Sinisa Milivojevic <sinisa@xxxxxxxxx>
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB
/_/ /_/\_, /___/\___\_\___/ Full time Developer and Support Coordinator
<___/ www.mysql.com Larnaca, Cyprus


--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe:
http://lists.mysql.com/plusplus?unsub=gcdmc-plusplus@xxxxxxxxxxx




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
ide.eclipse.wtp...    bug-tracking.ro...    xfree86.cvs/200...    lisp.wxcl.devel...    file-systems.ar...    kde.devel.kwrit...    jakarta.jetspee...    qnx.openqnx.dev...    drivers.openib/...    ports.xbox.deve...    gis.gdal.devel/...    netbsd.ports.ma...    ubuntu.marketin...    systemtap/2005-...    web.omniweb/200...    mail.qmail.ldap...    hardware.soekri...    os.netbsd.devel...    audio.madman.ge...    tv.freeguide-tv...    cluster.openmos...    education.ezpro...   
Home | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation