Sei sulla pagina 1di 2

Connect to Mysql using C API with Dev C++ IDE

Well after some tinkering I managed to get it going. It was pretty simple actually, just figuring out how to get Dev C++ to work with it proved to be most challanging. Anyhow, here are the simple steps to get you up and running. These steps assume that you have Dev C++ installed, mysql installed and running and a working knowledge of the C programming language. On my system I have xamppwhich provides a web interface to mysql using the apache server, if you get this you can create your own database, connect to it and execute querries, but for this tutorial we'll just use the default mysql database that comes pre-installed.

Step 1
Download and install the mysql devpak for Dev C++

Step 2
Open Dev C++ and go to tools -> compiler options (depicted below)

In the compiler options dialog add the following command to the linker: -lmysql, as shown below

And that should be it for now, just ensure you have mysql running and you should be ready to code!