NO

Author Topic: POLINK errors when building with MySQL API  (Read 3846 times)

SodaPop

  • Guest
POLINK errors when building with MySQL API
« 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.

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2096
POLINK errors when building with MySQL API
« Reply #1 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.
It is better to be hated for what you are than to be loved for what you are not. - Andre Gide

SodaPop

  • Guest
POLINK errors when building with MySQL API
« Reply #2 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.

SodaPop

  • Guest
POLINK errors when building with MySQL API
« Reply #3 on: August 25, 2006, 10:16:19 PM »
Attached are the ppj and c files as well.

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2096
POLINK errors when building with MySQL API
« Reply #4 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).
It is better to be hated for what you are than to be loved for what you are not. - Andre Gide

SodaPop

  • Guest
POLINK errors when building with MySQL API
« Reply #5 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.