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.
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.
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.
Attached are the ppj and c files as well.
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).
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.