I assume that you already created C++ Win32 project where you want to include SQLite.
- Navigate to https://www.sqlite.org/download.html and download latest
amalgamation
source version of SQLite. - Extract all the files into your project directory, or your include path, or separate path that you will add/added as include path in your project properties.
- Run
Developer Command Prompt for VS ****
which is usually available atStart -> Programs -> Visual Studio **** -> Visual Studio Tools
. - Navigate with command prompt to that directory where we extracted our SQLite.
- Run next command to compile:
cl /c /EHsc sqlite3.c
- Run next command to create static library:
lib sqlite3.obj
- Open properties of your project and add
sqlite3.lib
toLinker -> Input -> Additional Dependencies
.
Now you ready to include and use sqlite3.h
in your project.
If anybody gets unresolved reference linker errors when trying to use the sqlite library, make sure that the bitness of the developer command prompt matches your target platform. It ran in 32 bit mode by default for me which I didn't realize at the time.
Thanks for this guide, it works perfectly.