I type also:

bash-3.1# find / -name sqlite3.c
bash-3.1# 

sqlite3.c is not present in my system, and after

bash-3.1# gcc CreaDB.c sqlite3.c -o CreaDb
gcc: sqlite3.c: No such file or directory
CreaDB.c: In function 'main':
CreaDB.c:21: warning: incompatible implicit declaration of built-in function 
'strlen'
CreaDB.c:5: warning: return type of 'main' is not 'int'
CreaDB.c:41:3: warning: no newline at end of file
bash-3.1# ls
CreaDB.c  Desktop  GNUstep  loadlin16c.txt


dark0s dark0s <[EMAIL PROTECTED]> ha scritto: bash-3.1# gcc CreaDB.c sqlite3.c 
-o CreaDb
gcc: sqlite3.c: No such file or directory
CreaDB.c: In function 'main':
CreaDB.c:21: warning: incompatible implicit declaration of built-in function 
'strlen'
CreaDB.c:5: warning: return type of 'main' is not 'int'
CreaDB.c:41:3: warning: no newline at end of file
bash-3.1# ls
CreaDB.c  Desktop  GNUstep  loadlin16c.txt
bash-3.1# 

What is the problem? CreaDB is not present


Amit Uttamchandani <[EMAIL PROTECTED]> ha scritto: On Sat, 5 Apr 2008 18:16:47 
+0200 (CEST)
dark0s dark0s  wrote:

> Hi all, I am newbye in sqlite programming.
> I written a little C program to begin with sqlite, and I posted it below:
> 
> #include 
> #include 
> #include 
>  
> void main() {
> 
>   int rc, i;
>   sqlite3* db;
>   sqlite3_stmt* stmt;
>   char* sql;
>   const char* tail;
> 
>   rc = sqlite3_open("prova.db", &db);
>   if (rc) {
>     fprintf(stderr, "E' impossibile aprire il file %s\n", sqlite3_errmsg(db));
>     sqlite3_close(db);
>     exit(1);
>   }
> 
>   sql = "create table modulo(id, nome, classe, istanza);";
>   rc = sqlite3_prepare(db, sql, strlen(sql), &stmt, &tail);
>   if (rc != SQLITE_OK) {
>     fprintf(stderr, "Errore SQL: %s\n", sqlite3_errmsg(db));
>   }
> 
>   rc = sqlite3_step(stmt);
> 
>   while (rc == SQLITE_ROW) {
>     for (i = 0; i < sqlite3_column_count(stmt); i++)
>       fprintf(stderr, "'%s' ", sqlite3_column_text(stmt, i));
>     fprintf(stderr, "\n");
>     rc = sqlite3_step(stmt);
>   }
> 
>    sqlite3_finaqlize(stmt);
>   sqlite3_close(db);
> 
> }
> 
> So, when I compile above program the result is:
> 
> bash-3.1# gcc CreaDB.c -o CreaDB
> CreaDB.c: In function 'main':
> CreaDB.c:21: warning: incompatible implicit declaration of built-in function 
> 'strlen'
> CreaDB.c:5: warning: return type of 'main' is not 'int'
> CreaDB.c:41:3: warning: no newline at end of file
> /tmp/ccs8L4Zw.o: In function `main':
> CreaDB.c:(.text+0x1f): undefined reference to `sqlite3_open'
> CreaDB.c:(.text+0x37): undefined reference to `sqlite3_errmsg'
> CreaDB.c:(.text+0x5e): undefined reference to `sqlite3_close'
> CreaDB.c:(.text+0xa4): undefined reference to `sqlite3_prepare'
> CreaDB.c:(.text+0xbc): undefined reference to `sqlite3_errmsg'
> CreaDB.c:(.text+0xe3): undefined reference to `sqlite3_step'
> CreaDB.c:(.text+0x103): undefined reference to  `sqlite3_column_text'
> CreaDB.c:(.text+0x12d): undefined reference to `sqlite3_column_count'
> CreaDB.c:(.text+0x154): undefined reference to `sqlite3_step'
> CreaDB.c:(.text+0x16c): undefined reference to `sqlite3_finaqlize'
> CreaDB.c:(.text+0x17b): undefined reference to `sqlite3_close'
> collect2: ld returned 1 exit status
> 
> 
> What is the problem?
> 
> Thanks,
> savio
> 

>From what I can see you have to pass sqlite3.c to gcc when compiling your 
>program:

gcc CreaDB.c sqlite3.c -o CreaDB

Amit



           

---------------------------------
 Inviato da Yahoo! Mail. 
 La casella di posta intelligente.



       
---------------------------------
Inviato da Yahoo! Mail.
La casella di posta intelligente.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to