How to use SQLite in C++ program using Code::Blocks?
===

I'm a complete beginner with Code::Blocks and SQLite, and have some basic knowledge with C++. I'm currently using Ubuntu 11.04. 

I have downloaded SQLite Amalgamation [here][1]. When I extracted the zip file, there are four files inside: `shell.c`, `sqlite3.c`, `sqlite3.h`, and `sqlite3ext.h`. If I simply add those files to a (for example) a console project, it gives out an error: the .c's of the downloaded sqlite each have their own main function. Removing those from the project, the errors are gone and I can call `#include "sqlite3.h"`. I am trying to follow [this][2], and tried the first two lines of code from [here][3] and it gives out an error: `undefined reference to sqlite3_open`.

I think adding those .h's directly to a console project isn't the right way to use it, though I'm not sure.

How exactly should I use those? What should I do to use those for my C++ program?

EDIT: I also tried to create a .a file of those sqlite files by following [this][4]. When I try it, it gives out an error: `cannot find -lsqlite`.


  [1]: http://www.sqlite.org/download.html/
  [2]: http://stackoverflow.com/questions/11229862/sqlite3-api-was-not-declared-in-this-scope
  [3]: http://www.dreamincode.net/forums/topic/122300-sqlite-in-c/
  [4]: http://turrier.fr/tutoriels/c_05/create-and-use-a-static-library-with-c-or-c++.html