POLINK errors when building with MySQL API

Started by SodaPop, August 25, 2006, 04:41:31 PM

Previous topic - Next topic

SodaPop

Hi -

I'm building a project with Pelles C and the MySQL API. When building the project I receive errors such as

POLINK: error: Unresolved external symbol '_mysql_init'
POLINK: error: Unresolved external symbol '_mysql_real_connect'
POLINK: error: Unresolved external symbol '_mysql_close'

My project has the following characteristics:

#include <windows.h>
#include <mysql.h>

Project Options > Compiler tab > Enable Microsoft extensions enabled

Project Options > Linker tab > odbc32.lib added to library and object files

Any clues? Thank you.

frankie

If I well remember I already posted an answer for this topic, but I cannot find it, probably old pages have been removed from the forum.
Anyway if I well remember the problem was the definition of a symbol for the preprocessor, but I don't remember which one.
Please post the mysql.h header or better a sample project, and I'll take a look.
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

SodaPop

Thank you for the offer. Atttached is the mysql.h file. Other files that come with the API are mysql_com.h and mysql_version.h and mysqld_error.h. I'll attach if you need them.

SodaPop

Attached are the ppj and c files as well.

frankie

You have probably to define __LCC__ symbol to include the winsock.h header, or you can include it before the mysql as follows:
#include <windows.h>
#include <winsock.h>
#include <mysql.h>

The problem is that you have not included the mysql library in the linker stream. The symbols you miss are there. (check in the mysql SDK there should be  a library and probably a dll).
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

SodaPop

Yes, you are correct. I added libmysql.lib to Project Options - Linker tab - Library and object files. In addition, I placed libmysql.dll in the project directory contaning the executable. Now it works perfectly. Thanks.