Tikky wrote:
Hi ,
I am struggling to connect SQLite database through C program.
I got some code from the SQLite.org, when ever i tried to compile that c
code it showing error like " Unable to include sqlite.h file". Please refer
me solution.
This is an FAQ: sqlite.h and sqlite3.h are generated from sqlite.h.in
The second FAQ is "what is your platform/environment?" ;)
I'm posting a fairly lengthy reply to this because it is an FAQ and I'm
hoping this will clear things up and get spotted by the search engines
for future use.
The makefile recipe in versions 3.2.1, 3.2.8, 3.3.4, 3.3.5 (all I have
here) build sqlite3.h by copying sqlite.h.in to sqlite3.h, replacing
some tags with the current version.
If you don't have proper build tools (i.e. you're on Windows) you can do
this by hand but you MUST check the makefile (main.mk) to make sure the
recipe to build sqlite.h hasn't changed.
In the versions I mentioned above, the recipe (excepting the line wrap)
looks like this:
sqlite3.h: $(TOP)/src/sqlite.h.in
sed -e s/--VERS--/`cat ${TOP}/VERSION`/ \
-e s/--VERSION-NUMBER--/`cat ${TOP}/VERSION | sed 's/[^0-9]/ /g' |
awk '{printf "%d%03d%03d",$$1,$$2,$$3}'`/ \
$(TOP)/src/sqlite.h.in >sqlite3.h
sed copies a modified version stdin to stdout. The mods performed are
specified by the regular expressions after the "-e".
awk splits lines into fields and prints them as per the C style printf
format specifier.
The results of the above are to:
1: replace the text "--VERS--" in sqlite.h.in with the contents of
the file VERSION,
2: then replace the text "--VERSION-NUMBER--" in sqlite.h.in with
the contents of the file VERSION after the digits have been split
up and printed in "%d%03d%03d" format,
3: copy the result to sqlite3.h
Thus if VERSION contains 1.2.3, you can copy sqlite.h.in to sqlite3.h
and then edit sqlite3.h to replace "--VERS--" with "1.2.3" and replace
"--VERSION-NUMBER--" with "1002003"
As I said above, you MUST check the sqlite3.h recipe in the makefile
because if Dr Hipp adds any new version numbers to the source (unlikely?
but very possible) your build WILL fail with an undefined symbol.
Martin
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------