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.