{"id":304,"date":"2013-02-15T18:29:18","date_gmt":"2013-02-15T12:59:18","guid":{"rendered":"http:\/\/vikku.info\/codesnippets\/?p=304"},"modified":"2013-02-15T18:29:18","modified_gmt":"2013-02-15T12:59:18","slug":"using-compiling-sqlite-with-dev-cpp-for-c-project-and-cpp-project","status":"publish","type":"post","link":"http:\/\/vikku.info\/codesnippets\/win32api\/using-compiling-sqlite-with-dev-cpp-for-c-project-and-cpp-project\/","title":{"rendered":"Using\/Compiling SQLite with Dev-C++ for c project and cpp project"},"content":{"rendered":"<p>How to compile sqlite with c or c++ project in DEV-C++ IDE?<\/p>\n<p>That was my question when i wanted to use sqlite in my c and cpp program.<\/p>\n<p>I searched the internet for sqlite library for dev c++ and used some which worked for me.<\/p>\n<p>For all the options include sqlite3.h<\/p>\n<hr \/>\n<p><strong>OPTION 1: <\/strong><br \/>\n<strong>To compile sqlite3.c with a C project<\/strong><\/p>\n<p>Download <a href=\"http:\/\/www.sqlite.org\/sqlite-amalgamation-3071502.zip\">http:\/\/www.sqlite.org\/sqlite-amalgamation-3071502.zip<\/a> which can be found in <a href=\"http:\/\/www.sqlite.org\/download.html\">http:\/\/www.sqlite.org\/download.html<\/a> &#8211; the amalgamation.<\/p>\n<p>Open the zip and copy sqlite3.c to your project folder.<\/p>\n<p>I assume that you have created a c project(for cpp i have mentioned below)<\/p>\n<p>In dev c++ ide right click the project name which is listed in the project explorer pane at the left side and select &#8216;Add to Project&#8217;. Choose the sqlite3.c file and after that you can see sqlite3.c listed in project explorer with other files.<\/p>\n<p>Press F9 to check whether it is compiling or not. It should.<\/p>\n<p>By doing this all the functions of sqlite3 are statically included in the final executable executable.<\/p>\n<hr \/>\n<p><strong>OPTION 2:<\/strong><br \/>\n<strong>To compile sqlite3.c with a C++ project<\/strong><\/p>\n<p>now we need to create a cpp program which uses sqlite3.<\/p>\n<p>Do as mentioned in STEP 1 and &#8230;<\/p>\n<p>Go to Project &gt;&gt; Project Options &gt;&gt; Files.<\/p>\n<p>Select sqlite3.c and untick the &#8220;Compile file as C++&#8221; option. (If we do not do this step then we get  invalid conversion errors)<\/p>\n<p>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.<\/p>\n<p>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<\/p>\n<hr \/>\n<p><strong>OPTION 3<\/strong><br \/>\n<strong>using sqlite DEVPAK in dev C++<\/strong><\/p>\n<p>This option works for both c project and cpp project.<\/p>\n<p>Download sqlite devpak from<br \/>\n<a href=\"http:\/\/www.ce.unipr.it\/people\/medici\/DevPak\/sqlite-3.6.22-2pm.DevPak\">http:\/\/www.ce.unipr.it\/people\/medici\/DevPak\/sqlite-3.6.22-2pm.DevPak<\/a> which is present in devpak site <a href=\"http:\/\/devpaks.org\/details.php?devpak=281\">http:\/\/devpaks.org\/details.php?devpak=281<\/a><\/p>\n<p>(OR)<\/p>\n<p><a href=\"http:\/\/sourceforge.net\/projects\/devpaks\/files\/SQLite\/sqlite%203.5.6\/\">http:\/\/sourceforge.net\/projects\/devpaks\/files\/SQLite\/sqlite%203.5.6\/<\/a><\/p>\n<p>In dev c++ ide select Tools &gt;&gt; Package Manager<\/p>\n<p>The package manager window will open. In that select Install and it will show a dialog box to select the *.devpak file.<br \/>\nNow select the devpak file you downloaded from the above links. Done.<\/p>\n<p>You can compile sqlite with a c project or cpp project&#8230; it worked for me with c++ project and home it will work for a c project as well. i haven&#8217;t checked for the latter.<\/p>\n<hr \/>\n<p><strong>References<\/strong><\/p>\n<ul>\n<li><a href=\"http:\/\/stackoverflow.com\/questions\/14854994\/dev-cpp-win32-the-program-cant-start-because-sqlite3-dll-is-missing\">program can&#8217;t start because sqlite3.dll is missing while compiling c or cpp project<\/a><\/li>\n<li><a href=\"http:\/\/www.cplusplus.com\/forum\/general\/24340\/\">Compiling SQLite with Dev-C++<\/a><\/li>\n<\/ul>\n<hr \/>\n<p>&#8212;-<\/p>\n<p>That is all folks. Enjoy.<\/p>\n<p>&#8212;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 OPTION 1: To compile [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[],"_links":{"self":[{"href":"http:\/\/vikku.info\/codesnippets\/wp-json\/wp\/v2\/posts\/304"}],"collection":[{"href":"http:\/\/vikku.info\/codesnippets\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/vikku.info\/codesnippets\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/vikku.info\/codesnippets\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/vikku.info\/codesnippets\/wp-json\/wp\/v2\/comments?post=304"}],"version-history":[{"count":10,"href":"http:\/\/vikku.info\/codesnippets\/wp-json\/wp\/v2\/posts\/304\/revisions"}],"predecessor-version":[{"id":314,"href":"http:\/\/vikku.info\/codesnippets\/wp-json\/wp\/v2\/posts\/304\/revisions\/314"}],"wp:attachment":[{"href":"http:\/\/vikku.info\/codesnippets\/wp-json\/wp\/v2\/media?parent=304"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/vikku.info\/codesnippets\/wp-json\/wp\/v2\/categories?post=304"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/vikku.info\/codesnippets\/wp-json\/wp\/v2\/tags?post=304"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}