to access MySQL

hello, all,

  i have very simple C++ program, which is to be used to create a connection with MySQL (V4.0) server. In this short program only few MySQL APIs are called, such as "mysql_init(...)", "mysql_real_connect(...)". of course, the header file was included "mysql.h".
  This  program had been successfully compiled, however, when it is to be linked to an exe file, a few errors were thrown out ( the error info is following ) , is the command wrong , or do any other header files have to be included in source?
  Operating system is RedHat !

-------------------------------------------------------------------------------------------------------------
[root@hw userproject]# gcc -I../include Test.o ../lib/libmysqlclient.a -o test
Test.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
../lib/libmysqlclient.a(my_compress.o)(.text+0xb4): In function `my_compress_alloc':
: undefined reference to `compress'
../lib/libmysqlclient.a(my_compress.o)(.text+0x12a): In function `my_uncompress':
: undefined reference to `uncompress'
collect2: ld returned 1 exit status
-------------------------------------------------------------------------------------------------------------

  thanx in advance
kim_weiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gtkfreakCommented:
Do you have any files in /usr/lib/mysql path? Also, check if you have installed mysql-devel package for your distro.
0
kim_weiAuthor Commented:
hello, gtkfreak,

 i found a solution, it looks like,

[root@hw userproject]# gcc -o Test Test.cpp  -I../include Test.o -L../lib -lmysqlclient -lz,
however, i hav no idea about the option "-lz"? any idea?

thanx

kim
0
gtkfreakCommented:
No. I use Anjuta IDE for C programming and in there, I can add the libraries to the make file. This makes it more easy to manage large software projects. Anjuta is available at http://www.anjuta.org

To find what -lz stands for, you can try $ man gcc on the command line on your system.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux OS Dev

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.