it is included. the program which i m compiling is attached and thats the
sample program available on sqlite3.org but again its giving me error.

regards


On 8/31/07, kirrthana M <[EMAIL PROTECTED]> wrote:
>
> I think you have not included header file "sqlite3.h" in your code,if u
> have
> not included include and compile again.
>
> -----Original Message-----
> From: nishit sharma [mailto:[EMAIL PROTECTED]
> Sent: Friday, August 31, 2007 12:45 PM
> To: sqlite-users@sqlite.org
> Subject: [sqlite] compiling
>
>
> hi all,
> i have made a sampe which is opening a database file but i m
> unable to compile that source code and getting error that
> undefined reference to sqlite3_open().
> i m compiling as
> gcc test.c
>
> can anybody tell that these is the command to compile
> sqlite3 application or we have any other command
>
> waiting for reply
>
> regards
> Nishit
>
>
> The information contained in this electronic message and any attachments
> to this message are intended for the exclusive use of the addressee(s) and
> may contain proprietary, confidential or privileged information. If you are
> not the intended recipient, you should not disseminate, distribute or copy
> this e-mail. Please notify the sender immediately and destroy all copies of
> this message and any attachments contained in it.
>
> Contact your Administrator for further information.
>
>
> -----------------------------------------------------------------------------
> To unsubscribe, send email to [EMAIL PROTECTED]
>
> -----------------------------------------------------------------------------
>
>
#include <stdio.h>
#include <sqlite3.h>

static int callback(void *NotUsed, int argc, char **argv, char **azColName){
  int i;
  for(i=0; i<argc; i++){
    printf("%s = %s\n", azColName[i], argv[i] ? argv[i] : "NULL");
  }
  printf("\n");
  return 0;
}

int main(int argc, char **argv){
  sqlite3 *db;
  char *zErrMsg = 0;
  int rc;

  if( argc!=3 ){
    fprintf(stderr, "Usage: %s DATABASE SQL-STATEMENT\n", argv[0]);
    exit(1);
  }
  rc = sqlite3_open(argv[1], &db);
  if( rc ){
    fprintf(stderr, "Can't open database: %s\n", sqlite3_errmsg(db));
    sqlite3_close(db);
    exit(1);
  }
  rc = sqlite3_exec(db, argv[2], callback, 0, &zErrMsg);
  if( rc!=SQLITE_OK ){
    fprintf(stderr, "SQL error: %s\n", zErrMsg);
    sqlite3_free(zErrMsg);
  }
  sqlite3_close(db);
  return 0;
}

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to