# SQLite questions

This is a discussion on SQLite questions within the C++ Programming forums, part of the General Programming Boards category; Hi, I am trying to incorporate SQLite into my current project. To get used to using it and to see ...

1. ## SQLite questions

Hi, I am trying to incorporate SQLite into my current project. To get used to using it and to see how it works I am writing a seperate app to intitially build my database from a space delimited file. My problem is I am not sure how to get SQLite working in my program. Can I just use the DLL? If so how do I get it working in my program? I tried putting the source directory into my project directory and #including sqlite3.h and although it compiles that way it says all the commands such as sqlite3_open, sqlite3_exec, etc are undefined references. I am using Dev-C++.
Thanks

2. This is the way I did it:

1. Download sqlitedll-3_3_7.zip and sqlite-source-3_3_7.zip

2. Extract sqlitedll-3.3.7.zip and then run from the command line:
Code:
`dlltool -D sqlite3.dll -d sqlite3.def -l libsqlite3dll.a`
You will now have libsqlite3dll.a, which should be placed in the MinGW lib directory.

3. Place sqlite3.dll in your system path.

4. Extract sqlite-source-3_3_7.zip and place sqlite3.h in your MinGW include directory.

5. When you link, you will need to supply the parameter: -lsqlite3dll
Sorry, but I cannot remember offhand how this was done in Dev-C++, but it can be done, most probably under the compiler settings interface.

3. Okay I opened a cmd prompt, navigated to the DLL directory and tried that command and got this:
Code:
```'dlltool' is not recognized as an internal or external command,
operable program or batch file.```
any idea?
thx

4. dlltool should be in your MinGW bin directory. You can either use the full path, or add the MinGW bin directory to your system path.

5. okay I think I am close to getting this but I'm not sure where I should actually place sqlite3.dll. Currently I have done the following:

-ran dlltool to get libsqlite3dll.a
-placed libsqlite3dll.a in C:\Dev-Cpp\lib\ (should this be in C:\Dev-Cpp\mingw32\lib)?
-placed sqlite3.h in C:\Dev-Cpp\include\ (there was no include directory in the mingw32 folder, this is why I added the two files to the lib/include folders in Dev-Cpp. I thought maybe they designed it so mingw used these folders?)
-In Dev-Cpp I added the linker paramter "-lsqlite3dll"
-sqlite3.dll is in the folder C:\Dev-Cpp\sqltest\sqldll-3_3_7\ and that is the location I used to add it to my system path.

When I compile I get a message box saying:

"This application failed to start because sqlite3.dll was not found...."

Thanks for the help so far. I am understanding how this is supposed to work I think but its my first time dealing with DLLs at all so I'm sorry if I sound completely clueless.

6. I'm not sure where I should actually place sqlite3.dll
I think you can just copy the dll over to the system32 subdirectory in the windows directory.

there was no include directory in the mingw32 folder, this is why I added the two files to the lib/include folders in Dev-Cpp. I thought maybe they designed it so mingw used these folders?
My apologies, I actually used the raw MinGW installation, so I forgot that this was with Dev-C++ install of MinGW. Basically, you can just change "MinGW x" to "Dev-C++ x".

7. yea all I had to do was put it in the system32 folder. I thought I could change the System Environment Variables and just add the path but I guess not. Anyway thanks for the help, everything seems to be working good.

Popular pages Recent additions