A few days ago I ran into SQLite, I was looking for a database system to include into my project. Well I don't really get the point how this works, does SQLite supports C++, what WIN Binaries do I have to download?

And what does it mean: "This is a DLL of the SQLite library without the TCL bindings. The only external dependency is MSVCRT.DLL". What is TCL and what does dependency to MSVCRT.DLL mean? I'm really new to this, so if anybody allready used this could he point me to the right direction? :confused: I just want my command line prog. to be able to write and read some data from a database...Is SQLite portable, because I use Linux and Win together, and I want it to be portable, with a .dll or something? :confused: :(

03-13-2005

laserlight

Quote:

does SQLite supports C++

Yes, under the C API.

Quote:

what WIN Binaries do I have to download?

hmm... I thought that was idiot proof, but maybe not :P
Download sqlite-3_1_5.zip to get you started with working with SQLite databases.
Download sqlitedll-3_1_5.zip so as to get the, um, dll.

Now here comes the part that I'm not sure of:
I also downloaded the source, in this case sqlite-source-3_1_5.zip
I extracted sqlite3.h from the source, and placed it in MinGW's include directory.
Then I did a:
dlltool -D sqlite3.dll -d sqlite3.def -l libsqlite3.a
on the contents of the sqlitedll zip (with MSYS, but I dont think that's needed).
I moved libsqlite3.a to MinGW's lib directory, and placed sqlite3.dll in Window's system32 directory.
sqlite3.exe I used for my own evil purposes (in MinGW's bin directory).

It works for me, but I'm not sure if it's the canonical way to go about it.
Oh, and for reference I'm using the MinGW port of GCC 3.4.2 on Windows XP.

Quote:

What is TCL and what does dependency to MSVCRT.DLL mean?

TCL is a programming/scripting language.
You most probably have 'MSVCRT.DLL' on your system.

03-13-2005

IM!

Well I use Borland C++ Compiler
1. Well i downloaded the sorces to, but how do I use it under win, do I have to move the header files into my include folder?
2... but how do I use the .dlls?

03-13-2005

laserlight

I'm assuming you're using MinGW too, since you didnt say otherwise when I mentioned it.

Quote:

in the second the .dll and some .def (what is this for?).

You can use the def and the dll together with dlltool to create libsqlite3.a
dlltool -D sqlite3.dll -d sqlite3.def -l libsqlite3.a
Then move libsqlite3.a to C:\MinGW\lib
Move sqlite3.dll to somewhere in your system path, probably in C:\Windows\system32

Quote:

Well I got them both but I was expecting to get some header files, where should I start? What to include?

That's why I downloaded sqlite-source-3_1_5.zip and extracted sqlite3.h (not the whole source tree, only that file) to C:\MinGW\include

In my source files I #include <sqlite3.h>
At linktime, I pass GCC the parameter -lsqlite3 to link with libsqlite3.a

If you happen to be using the Dev-C++ IDE, you can try the SQLite devpak available at devpaks.org

03-13-2005

IM!

I just edited my previos post :D ...got it, well I use Borland C++ Compiler...should I try to set the header file into my include folder? What are the other files in the source zip for?

03-13-2005

laserlight

Quote:

I use Borland C++ Compiler

hmm... I have no experience with Borland.

Quote:

should I try to set the header file into my include folder?

Yes, I suppose.
You might try a:
implib -a -c -f sqlite3.lib sqlite3.dll
Then place sqlite3.lib in lib, and add it to your project.
I'm adapting zlib's dll usage file instructions here, so this is just a guess.
There is also the note that you might need to pass the -a parameter to Borland's compiler so as to compile "using a 4-byte alignment" for modules that are linked to this library file.

That said, since you're using both Linux and MS Windows, why not go the MinGW route?

Quote:

What are the other files in the source zip for?

Compiling from scratch.

03-13-2005

IM!

I guess MinGW would be the right choice, well I also wanted to try DevC++ but in the app. description there was "The executables compiled by Dev-C++ will need MSVCRT.DLL", well I really don't like Microsoft, I want to make software that works on both systems, like for the graphical interface i use QT, works great on both systems!

03-13-2005

IM!

Ok I placed the header file into my include folder, then I tryed to compile the following code:

Nope! It's still not working, but don't worry I will get this to work! :mad: :D Maybe I should just switch to DevC++, is it really true that non of their compiled progs work without that MS .dll? :confused:

03-14-2005

IM!

Allright I installed DevC++ and the SQLite Pack...and it's still not working, same error as the one in my last post...ok...prelast... :rolleyes: Any ideas, I'm new to DevC++?

03-14-2005

okinrus

With devc++, are you generating the .a library file? MSVCRT is just the microsoft's c library or its some foundational library. That's not where the problem is because the functions in the error message are SQLite functions. You must not be linking in the sqlite's library or you've downloaded the old API with sqlite_ functions sqlite3 functions. Try reading this site and see if you generate a .lib file for borland. http://www.xploiter.com/programming/c/borland/3173.html

03-15-2005

IM!

Well I can use the IMPDEF command, but the LIB command is not working, it says that it can't recognize it?