NO

Author Topic: Pelles C and MySQL Quick Start Tutorial  (Read 7745 times)

rweidner

  • Guest
Pelles C and MySQL Quick Start Tutorial
« on: December 15, 2009, 02:22:23 pm »
If you don't have a server you can use to test your setup, Download and install MySQL Server.  I used XAMPP for this because I also needed Apache.
http://www.apachefriends.org/en/xampp.html

Download the "MySQL Connector" I used "Connector/C 6.0".  At the time of this writing you need to create an account so that you can login and download files. I downloaded the mysql-connector-c-noinstall-6.0.2-win32.zip file without the installer.
http://dev.mysql.com/downloads/connector/c/6.0.html

Once unziped or installed make sure you know where the MySQL lib and include directories are.

Open your project options dialog.  Under the compiler tab, enable Microsoft extensions. (also known as "setting the Ze flag")

Under the folders tab add the lib and includes folders for the MySQL Connector you just unzipped (or installed).

Under the linker tab add... libmysql.lib to the list of libs

Create a test program.  Make sure you include at least the following...
Code: [Select]
#include <windows.h>
#include <winsock.h>
#include <mysql.h>
...and compile the project.  I modified this program for my test.
http://www.cyberciti.biz/tips/linux-unix-connect-mysql-c-api-program.html

Copy the libmysql.dll next to the newly created .exe (found in the libs directory of the MySQL Connector)

Run. (We hope)

Update:
I've tried this with the latest version of Pelles C and this Quick Start is still accurate.

--
Ronald Weidner
www.techport80.com

« Last Edit: January 16, 2012, 04:19:38 am by rweidner »