Create an SPTK project that connects to a MySQL database using libmysql

1. Install MySQL.devpak
1.1 Download the MySQL-Devpack from here.
1.2 Double-click on the .devpak-file.
1.3 Click three times on "Next >" and then on "Install >" to install the devpack.
1.4 Click on "Finish".
1.5. Close the "DevC++ Package Manager".


2. Download my example
2.1 Download my example file from here and extract it into a new folder.
2.2 Start Dev-C++.
2.3 Click on "File" -> "New" -> "Project".
2.4 Select "Empty Project" and set any name in the Name-Textbox.
2.5 Click on "OK".
2.6 Save the Project in the same Directory where you extract the libmysqltest.c.
2.7 In the left part of Dev-C++ you can now see the new project. Right-click on it and select "Add to project".
2.8 Select libmysqltest.c and click on "Open".
2.9 Now you can see the libmysqltest.c under your project. Doubleclick on libmysqltest.c.
2.10 go into line 88 and adapt your connection-settings to your MySQL-Server:
mysql_real_connect( myData, "HOST", "USERNAME", "PASSWORD", "DATABASE", MYSQL_PORT, NULL, 0 ) )


3. Compile my example
3.1 Press ALT+P.
(You can compile it as Win32GUI or as console application, but I have no output on the console, so you should use Win32GUI to hide the ugly DOS-Box ;-) )
3.2 Click on "Parameters".
3.3 Click on "Add Library or Object" under the "Linker"-Textbox.
3.4 Select the file SPTKlib.a form the devcpp/lib directory.
3.5 Click on "Open".
3.6 Repeat 3.3 to 3.5 with the files libfltk.a, libfltk_forms.a, libfltk_images.a, libmysql.a and libfltk_gl.a
3.7 Click on "OK".
3.8 Press "F9".
3.9 You should see something like this:

3.10 (IMPORTANT) You need the libmysql.dll in the same folder where the .exe file is, so you must copy it with your program when you want to use it on another computer!

Now start to build your own MySQL-Project. If you have any questions send me a mail.

by Andreas Bresser andreasbresser (at) gmx (dot) de