I have the Dev-Cpp IDE installed and have successfully compiled and linked several test programmes and am satisfied that dev-cpp is functioning correctly.

However, upon attempting to compile and link a test programme which uses sqlite3 I have run into trouble.

The programme (below) compiles but fails to link. My current thinking is that I need to reference the sqlite3.def file supplied with sqlite3 but I do not know how to proceed from this point. I have, I might add, tried numerous schemes without success and would welcome some detailed instructions.

I have installed (all into the same \bin\sqlite directory) the following:
sqlite-3_1_3
sqlite-source-3_1_3
sqlitedll-3_1_3

The programme I am trying to link, from the sqlite "quickstart" web page is:

#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_close(db);
return 0;
}

Any assistance will be greatly appreciated

Bill Henderson

_________________________________________________________________
MSN Hotmail : choisissez votre adresse @hotmail.fr http://www.imagine-msn.com/hotmail/default.aspx?locale=fr-FR




Reply via email to