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 http://www.sqlite.org/sqlite-amalgamation-3071502.zip which can be found in http://www.sqlite.org/download.html - 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
http://www.ce.unipr.it/people/medici/DevPak/sqlite-3.6.22-2pm.DevPak which is present in devpak site http://devpaks.org/details.php?devpak=281
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.
- program can’t start because sqlite3.dll is missing while compiling c or cpp project
- Compiling SQLite with Dev-C++
That is all folks. Enjoy.