Pelles C forum

Pelles C => General discussions => Topic started by: SodaPop on August 25, 2006, 04:41:31 PM

Title: POLINK errors when building with MySQL API
Post by: SodaPop on August 25, 2006, 04:41:31 PM
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.
Title: POLINK errors when building with MySQL API
Post by: frankie on August 25, 2006, 09:16:35 PM
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.
Title: POLINK errors when building with MySQL API
Post by: SodaPop on August 25, 2006, 09:28:11 PM
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.
Title: POLINK errors when building with MySQL API
Post by: SodaPop on August 25, 2006, 10:16:19 PM
Attached are the ppj and c files as well.
Title: POLINK errors when building with MySQL API
Post by: frankie on August 26, 2006, 08:57:07 PM
You have probably to define __LCC__ symbol to include the winsock.h header, or you can include it before the mysql as follows:
Code: [Select]
#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).
Title: POLINK errors when building with MySQL API
Post by: SodaPop on August 28, 2006, 06:59:03 PM
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.