[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mingw-users
Subject:    Re: [Mingw-users] Installing SQLite
From:       Timo_Schlüßler <timo () schluessler ! org>
Date:       2007-06-09 15:22:20
Message-ID: 466AC5AC.2070107 () schluessler ! org
[Download RAW message or body]

Tuomo Latto wrote:
> Maybe you should ask on sqlite mailing list?
> After reading your post more carefully, I see your final problem is
> linker errors. Maybe if you posted some details, people might actually
> be able to help you.
>
>
>   
I dont't think that details of the error will help somebody finding the 
problem. For me it seems that mingw simply can't do anything with the 
libsqlite3.a file. Anyway here are the errors:

 >gcc -lsqlite3 test.c -o test
C:\DOKUME~1\Timo\LOKALE~1\Temp/ccKoaaaa.o:test.c:(.text+0xfa): undefined 
reference to `sqlite3_open'
C:\DOKUME~1\Timo\LOKALE~1\Temp/ccKoaaaa.o:test.c:(.text+0x10e): 
undefined reference to `sqlite3_errmsg'
C:\DOKUME~1\Timo\LOKALE~1\Temp/ccKoaaaa.o:test.c:(.text+0x135): 
undefined reference to `sqlite3_close'
C:\DOKUME~1\Timo\LOKALE~1\Temp/ccKoaaaa.o:test.c:(.text+0x16f): 
undefined reference to `sqlite3_exec'
C:\DOKUME~1\Timo\LOKALE~1\Temp/ccKoaaaa.o:test.c:(.text+0x1a2): 
undefined reference to `sqlite3_free'
C:\DOKUME~1\Timo\LOKALE~1\Temp/ccKoaaaa.o:test.c:(.text+0x1ad): 
undefined reference to `sqlite3_close'
collect2: ld returned 1 exit status

Here is the test.c test-programm:

#include <stdio.h>
#include <sqlite3.h>
#include <unistd.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;
}



sqlite3.h is in <mingw>/include/ and libsqlite3.a and sqlite3.dll is in 
<mingw>/lib/


But maybe I really should ask in the sqlite maling list.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
MinGW-users mailing list
MinGW-users@lists.sourceforge.net

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic