Mysql programming link in linux

Source: Internet
Author: User

I wrote a program yesterday and needed to write a database. I called MySQL's c API. A link error occurred during compilation:

/Usr/lib/MySQL/libmysqlclient. A (SSL. O) :(. GNU. linkonce. D. _ vt_q25yassl7message + 0x8): Undefined reference to '_ pure_virtual'

......

Link in makefile :...... -L/usr/lib/MySQL-lmysqlclient

The first response is that the installed MySQL devel and Client versions are incorrect. Check the current version carefully, and check rpm-Q-A | grep MySQL,

MySQL-devel-5.0.22-0
MySQL-server-community-5.1.59-1.sles10
MySQL-client-community-5.1.59-1.sles10

There should be no problem. It is the latest version of SuSE V10 on the MySQL official website. To ensure that there is no problem, it is ineffective to reinstall it again.

Starting from the omnipotent Google, I turned to a reliable article, saying that I wanted to link mygcc into the chain, so I changed it ...... -L/usr/lib/MySQL-lmysqlclient-lmygcc: Re-compile a new version with many fewer errors, but the following error occurs:

/Usr/lib/MySQL/libmysqlclient. A (my_compress.o): In function 'my _ compress_alloc ':
(. Text + 0xdb): Undefined reference to 'compus'
/Usr/lib/MySQL/libmysqlclient. A (my_compress.o): In function 'my _ uncompress ':
(. Text + 0x16d): undefined reference to 'uncompus'

For more information, see gzip without a link. Add-lz and change it to-L/usr/lib/mysql.
-Recompile lmysqlclient-lmygcc-lz! Or you can directly link to the dynamic link library without using-l:/usr/lib/mysql/libmysqlclient. a/usr/lib/mysql/libmygcc. a/usr/lib/libz. a, also compiled.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.