I am using Pelles C 6.00.4 for Windows on Vista. It doesn't compile and any
help would be appreciated.


/**See also the Introduction To The SQLite C/C++ Interface for an
introductory overview and roadmap to the dozens of SQLite interface
functions.**/

#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]);
   return 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);
    return 0; // 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;
}


Output:-

Building sqliteFirst.obj.
Building SQLiteFirst.exe.
POLINK: error: Unresolved external symbol '_sqlite3_open'.
POLINK: error: Unresolved external symbol '_sqlite3_errmsg'.
POLINK: error: Unresolved external symbol '_sqlite3_close'.
POLINK: error: Unresolved external symbol '_sqlite3_exec'.
POLINK: error: Unresolved external symbol '_sqlite3_free'.
POLINK: fatal error: 5 unresolved external(s).
*** Error code: 1 ***
Done.
-- 
View this message in context: 
http://www.nabble.com/Compile-test-example-problem-tp25724582p25724582.html
Sent from the SQLite mailing list archive at Nabble.com.

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to