0

I'm finding it difficult to understand how to get a start on SQLite... I know there are allot of tutorials out there but they all seem to go off on some tangent. Even the books is vuage on how to go about incorporating it into a C++ project. This is what I'm trying to do.

I am using Code::Blocks IDE that's with a MingW compiler and have downloaded the SQLite Amalgamation. SQLite is written in C but randomly (on the SQLite website) refers to the C/C++ API. The book: 'Using SQLite' (Orielly) mentions that you cannot compile SQLite in a C++ compiler.. I've referred to the section in'Using SQLite' below.

Question 1 - If you can't compile SQLite in a C++ compiler when you include the header file in your code then how on earth do you compile SQLite at all. How can you compile a Sourcecode file on its own??

Question 2 - The constant referral to the C/C++ API on the SQLite website is also confusing. If you can refer to the API via the header file then why can't it be compiled as part of a project?

Question 3 - I am using an IDE (Code::Blocks). Below in bold it says, that the sqlite3.c header should be added to the applications project file and configured with the proper search paths and build directives ( I have no idea what this means but I'm assuming it's referring to directives in relation to Code::Blocks), is that right. Obviously it's a massive flaw in my knowledge but I have scoured the net for 4 months now and can't make sense of what this is telling me. I have basically taken the view that I include the sqlite3.h (the header file) in my projects and place that and the source code file in my 'Include' directory in the Code::Blocks directory.

I'm having allot of problems here. A grateful thanks to anyone who can help me with these three questions.
If there's something I should be reading before delving into this I'm prepared to spend the time to do so as it's taken me a long time to reach this point of vuageness.

There are a number of different ways to build SQLite, depending on what you’re trying
to build and where you would like it installed. If you are trying to integrate the SQLite
core into a host application, the easiest way to do that is to simply copy sqlite3.c and
sqlite3.h into your application’s source directory. If you’re using an IDE, the sqlite3.c
file can simply be added to your application’s project file and configured with the proper
search paths and build directives.
If you want to build a custom version of the SQLite
library or sqlite3 utility, it is also easy to do that by hand.
All of the SQLite source is written in C. It cannot be compiled by a C++ compiler. If
you’re getting errors related to structure definitions, chances are you’re using a C++
compiler. Make sure you use a vanilla C compiler.

Edited by daino: spelling

1
Contributor
1
Reply
3
Views
5 Years
Discussion Span
Last Post by daino
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.