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. #1
    Registered User
    Join Date
    May 2006
    Posts
    89

    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. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,401
    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.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    May 2006
    Posts
    89
    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. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,401
    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.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #5
    Registered User
    Join Date
    May 2006
    Posts
    89
    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. #6
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,401
    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".
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  7. #7
    Registered User
    Join Date
    May 2006
    Posts
    89
    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 subscribe to a feed

Similar Threads

  1. A very long list of questions... maybe to long...
    By Ravens'sWrath in forum C Programming
    Replies: 16
    Last Post: 05-16-2007, 05:36 AM
  2. Several Questions, main one is about protected memory
    By Tron 9000 in forum C Programming
    Replies: 3
    Last Post: 06-02-2005, 07:42 AM
  3. Using SQLite?
    By IM! in forum C++ Programming
    Replies: 18
    Last Post: 03-16-2005, 03:00 AM
  4. Trivial questions - what to do?
    By Aerie in forum A Brief History of Cprogramming.com
    Replies: 23
    Last Post: 12-26-2004, 08:44 AM
  5. questions questions questions.....
    By mfc2themax in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 08-14-2001, 07:22 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21