I want to use libmysqlclient on a project cross compiled to Windows via mingw. In order to link my program, I need "mysqlclient.a" but I'm not able to get it.
I tried to create makefiles for mingw on windows for mysql client, but the configuration step fail.
I was finaly able to build it... using mingw on Windows.
Here are the steps:
- Install cygwin
- Install packages make, gcc, g++, cmake and cygidn in your cygwin
- Download & uncompress libmysql source code
- Edit file strings/dtoa.c and replace all occurance of
dtoa
to something else like_dtoa
to prevent conflicts - cd to the package base
- type cmake -G "Unix Makefiles" in mingw
- make
- make install
- edit C:\cygwin\usr\local\mysql\include\mysql.h and add
#include <winsock.h> /* Bug win32 */
after#define _mysql_h
- You can get your files in "C:\cygwin\usr\local\mysql"
I get "libmysqlclient.a" and "liblibmysql.dll.a" and I link my program with them but I still get linker error. What's wrong ? But I still get linking error !
strings libmysqlclient.a | grep _mysql_ping
returns a result while the linker complains about undefined reference to `_mysql_ping@4'