You don't seem to have the sqlite3 link library in your compile and link command.

MaaSTaaR wrote:
Hello ...

firstly, sorry for my bad English.

i am using SQLite with C under Linux, i wrote small file which use Glade,
GTK and SQLite, but i have problem with SQLite.

this is the command which i used to compile the file : "gcc `pkg-config
--libs --cflags gtk+-2.0 libglade-2.0 sqlite` -o main main.c"

these the problems :
/tmp/ccxN97zv.o: In function `main':main.c:(.text+0x53): undefined reference
to `sqlite3_open'
:main.c:(.text+0x161): undefined reference to `sqlite3_close'
collect2: ld returned 1 exit status

finally this is my code :

#include <stdio.h>
#include <gtk/gtk.h>
#include <glade/glade.h>
#include <sqlite3.h>

void start(GtkWidget *b,GtkWidget *t)
{
   const gchar *text;

   text = gtk_entry_get_text(GTK_ENTRY(t));
}

int main(int argc, char *argv[])
{
   GladeXML *ui;
   GtkWidget *w,*t,*b;
   sqlite3 *db;
   int rc;

   rc = sqlite3_open("./db/def.db",&db);

   gtk_init(&argc,&argv);
   ui = glade_xml_new("./gui/main.glade",NULL,NULL);

   w = glade_xml_get_widget(ui,"window1");

g_signal_connect(G_OBJECT(w),"delete-event",G_CALLBACK(gtk_main_quit),NULL);

   t = glade_xml_get_widget(ui,"word"); // This is label

   b = glade_xml_get_widget(ui,"start"); // This is button
   g_signal_connect(G_OBJECT(b),"clicked",G_CALLBACK(start),(gpointer)t);

   gtk_main();

   sqlite3_close(db);
}


what is this error and how to solve it?



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

Reply via email to