Thread: sqlite3 library installion issue on windows

  1. #1
    Registered User
    Join Date
    Dec 2016
    Posts
    6

    sqlite3 library installion issue on windows

    SQLite3 C interface Sample Code:

    Code:
    #include <stdio.h>
    #include <sqlite3.h> 
    
    
    int main(int argc, char* argv[])
    {
       sqlite3 *db;
       char *zErrMsg = 0;
       int rc;
    
    
       rc = sqlite3_open("test.db", &db);
    
    
       if( rc ){
          fprintf(stderr, "Can't open database: %s\n", sqlite3_errmsg(db));
          return(0);
       }else{
          fprintf(stderr, "Opened database successfully\n");
       }
       sqlite3_close(db);
    }
    I have installed sqlite3 using following link:
    SQLite - Installation

    (I have created a folder in C: drive and placed pre-compiled binaries there along with sqlite3.h header file)

    on compilation:
    Code:
    gcc -o sample sample.c -I C:\SQLite3
    undefined reference to `sqlite3_open'
    undefined reference to `sqlite3_errmsg'
    undefined reference to `sqlite3_close'
    collect2.exe: error: ld returned 1 exit status
    So my question is how to install sqlite3 library in windows correctly?

    Any help will be appreciated. Thank you.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    38,798
    > (I have created a folder in C: drive and placed pre-compiled binaries there along with sqlite3.h header file)
    The precompiled binaries are complete programs in their own right.

    What you also need are the library files to match.
    These are .a and .so files on Linux, or perhaps .lib and .dll files on Windows.

    Where did you get sqlite3.h from?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Windows 8 issue.
    By Fossaw in forum Tech Board
    Replies: 2
    Last Post: 07-13-2013, 07:54 PM
  2. SQLITE3, GtkTreeView and C problem !
    By Ravi Raj in forum C Programming
    Replies: 2
    Last Post: 06-05-2012, 02:45 AM
  3. Windows Under The Hood issue
    By kmilic in forum Windows Programming
    Replies: 5
    Last Post: 04-03-2009, 02:09 AM
  4. C++ & Sqlite3
    By Sparrowhawk in forum Windows Programming
    Replies: 2
    Last Post: 03-11-2009, 01:33 PM

Tags for this Thread