Hi all,

I've been playing around with SQLite through the command line
interface and with php and am very impressed. I'm now trying to use
sqlite with C++ but am running into a small problem when linking.

Firstly I'm using SQLite 2.8, which I compiled from source and this is
located in ~user_account/sqlite

My trivial test C program is as follows:

#include <string>
#include <iostream>
#include "sqlite.h"

using namespace std;

typedef struct sqlite sqlite;

int main(void){

  const char *DbFilename;
  DbFilename = "test.db";
  cout <<"test:"<<DbFilename<<endl;
  char *ErrMsg = 0;

  static sqlite *db = 0;

  db = sqlite_open(DbFilename, 0, &ErrMsg);
  sqlite_close(db);

  return 1;
}


I'm trying to compile this as follows:

g++ test_sqlite.cpp -Wall -I/<user_account>/sqlite/include/ -o test

But I get an undefined reference to sqlite_open and sqlite_close. I
think this is because it needs some sqlite library? So I tried:

g++ test_sqlite.cpp -Wall -I/<user_account>/sqlite/include/
-l/<user_account>/sqlite/lib/libsqlite.so -o test        (btw if the
font isn't clear thats "capital i" and "little L" I'm using for the
include directory and the library directory)

But it can't find the library, though the file is definitely located there

I'm probably missing something very straightforward here - if anyone
spots it I'm be extremely grateful for feedback
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to