Anyone who reads this blog regularly will wonder why this post is here (like anyone reads this regularly, lol). Basically, I am posting this information for my own reference should I need to come back to it later. Having said that, if the information can help someone else, then that’s even better. The information provided is how I was able to get SQLite working in a Embedded Visual C++ project and running in the PocketPC 2003 SE Emulator.
By no means am I proclaiming this is the only way to do this, nor am I proclaiming this is the correct way to do this. Your use may very. Please do not write to me if this doesn’t work for you, I probably can’t help you!It took me forever to make it work on my system, and the chances I could figure out what is wrong with your system are slim to none.
Having said that, lets get started. First, you will need some software.
- eMbedded Visual C++ and SP4
- PocketPC 2003 SDK
- Emulator Images for PPC 2003 SE
- SQLite Source (I used 3.4.1)
First, you have to compile SQLite into a library.
- Create a new WCE Static Library Project
- I named mine sqlitelib. Accept all the defaults, so that an empty project is created
- Extract the sqlite source into the project directory
- Delete the files icu.c, shell.c, & tclsqlite.c, they are not needed
- Add the remaining files to the project (Project/Add To Project/Files)
- Build the Project. You will need to compile the library for the system you are running it on (i.e. emulator, or actual PPC).
Now create your Pocket PC application. To Test I created the Simple Hello World Example and added the commands to open and close a database to see if the database file would be created. The steps to get the project to compile were
- Copy sqlite3.h to your project directory
- Copy the library file that you just compiled (in my case, sqlitelib.lib) to the project directory
- In your main .cpp file, add
#include "sqlite3.h"
- In project settings, on the link tab, append your library file name to the library/object modules
This should get your project to compile. Anything past that… Well I haven’t gotten past that yet, so wish me luck.