I Googled it. I could not find an easy example of how to set up an environment to do this, so I decided to research a bunch and write my own tutorial!
First things first. You need:
- Ubuntu (or other linux distribution)
- A functioning MySQL database to read from
The first thing you need to do is to install the MySQL++ library on linux. Open up Terminal and type "sudo apt-get install libmysql++-dev" and press enter.
It should ask for your password, so type that in and watch it install MySQL++.
Now that that is over, create a new folder and navigate to it in Terminal. Create two blank files, naming one "main.cpp" and "makefile" for the other.
Inside of "main.cpp", paste the following:
Inside of "makefile", paste the following:
Now, you have the basic template saved. You must fill in your MySQL database information for the variables "db", "server", "user", and "pass" in order for this program to work.
Once you have the database info filled in, where it says "select * from database", you may change that to something more appropriate, such as "select first_name, last_name, user_id, email from users".
Now you may simply save it, run "make" and then run the program.