Using/Compiling SQLite with Dev-C++ for c project and cpp project

Win32 API Add comments

How to compile sqlite with c or c++ project in DEV-C++ IDE?

That was my question when i wanted to use sqlite in my c and cpp program.

I searched the internet for sqlite library for dev c++ and used some which worked for me.

For all the options include sqlite3.h

To compile sqlite3.c with a C project

Download which can be found in – the amalgamation.

Open the zip and copy sqlite3.c to your project folder.

I assume that you have created a c project(for cpp i have mentioned below)

In dev c++ ide right click the project name which is listed in the project explorer pane at the left side and select ‘Add to Project’. Choose the sqlite3.c file and after that you can see sqlite3.c listed in project explorer with other files.

Press F9 to check whether it is compiling or not. It should.

By doing this all the functions of sqlite3 are statically included in the final executable executable.

To compile sqlite3.c with a C++ project

now we need to create a cpp program which uses sqlite3.

Do as mentioned in STEP 1 and …

Go to Project >> Project Options >> Files.

Select sqlite3.c and untick the “Compile file as C++” option. (If we do not do this step then we get invalid conversion errors)

This should inform Dev-C++ that it should invoke gcc.exe, and not g++.exe cause gcc is for c files and g++ for cpp and since sqlite3.c is a c file we have to compile with a c compiler.

The reason for doing these i want to know how to include a source file into a project instead of using a .lib file or a .dll file

using sqlite DEVPAK in dev C++

This option works for both c project and cpp project.

Download sqlite devpak from which is present in devpak site


In dev c++ ide select Tools >> Package Manager

The package manager window will open. In that select Install and it will show a dialog box to select the *.devpak file.
Now select the devpak file you downloaded from the above links. Done.

You can compile sqlite with a c project or cpp project… it worked for me with c++ project and home it will work for a c project as well. i haven’t checked for the latter.



That is all folks. Enjoy.

Leave a Reply

Entries RSS