Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't compile MySQL C client.

Status
Not open for further replies.

BillGodfrey

Programmer
Aug 2, 2003
3
GB
Hello. I'm trying to get the example code at...
compiled.

I'm using the command line...
gcc -o mysqldemo mysqldemo.c -I/usr/include/mysql -L/usr/lib/mysql -lmysqlclient

And getting the result...

/tmp/ccHykNft.o: In function `main':
/tmp/ccHykNft.o(.text+0x3d): undefined reference to 'mysql_connect'
/usr/lib/mysql/libmysqlclient.a(my_compress.o): In function `my_uncompress':
my_compress.o(.text+0xaa): undefined reference to `uncompress'
/usr/lib/mysql/libmysqlclient.a(my_compress.o): In function `my_compress_alloc':
my_compress.o(.text+0x13c): undefined reference to `compress'
collect2: ld returned 1 exit status

uname says linux version 2.4.20-13.7
mysql --version says version 12.20 distrib 4.0.13.

Any ideas please?

Bill, trying to learn.
 
Just a quick update. I managed to eliminate the compress errors by adding -lz to the command line to include a compression library.

However, I'm still getting the mysql_connect error.

Please note it's the only undefined reference error and I'm already putting -lmysqlclient on the command line.

Is my installation of mysql bad, or have a screwed up somewhere? Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top