Looks like you haven't include the Sqlite library for the linker.
Ashish Singh wrote:
Hello SQLite Users
I am using SQlite 2.8.17 version
I am trying to compile this piece of code on linux system when i type the command
"g++
test.cpp"
I get the following error which is at the bottom of this mail.
If anybody could which is the library file I need to include I will be greatful
to him.
Thanks
Ashish
--------------------------------------------------------------------------------
#include<iostream>
#include "sqlite.h"
#include<string>
using namespace std;
typedef int (*sqlite_callback)(void*, int, char**, char**);
int main() {
const char* DB;
int mode=0;
// sqlite_stmt** statment;
char** errmsg;
sqlite* dbHandle;
// int length_stat;
// const char* p = "create table tbl1(one varchar(10), two
smallint)";
const void** pzTail;
// length_stat = strlen(p);
dbHandle = sqlite_open(DB, mode, errmsg);
// sqlite_prepare(*DB, "create table tbl1(one varchar(10), two
smallint)", length_stat,
statement, pztail);
sqlite_exec(dbHandle, "create table tbl1(one varchar(10), two
smallint)", 0, 0, errmsg);
char* name = "ashish";
char* numc;
char* fin_name;
int num;
for(int i=0;i<10;i++)
for(int j=0;j<1000;j++) {
num = i*1000+j;
*numc = (char)num;
fin_name = strcat(name, numc);
sqlite_exec(dbHandle, "insert into table tbl1(num, fin_name)", 0,
0, errmsg);
}
// printf("hi");
return 0;
}
--------------------------------------------------------------------------------------------
Error Message
--------------------------------------------------------------
g++ test.cpp
/tmp/ccxM7oLI.o(.text+0x24): In function `main':
: undefined reference to `sqlite_open'
/tmp/ccxM7oLI.o(.text+0x41): In function `main':
: undefined reference to `sqlite_exec'
/tmp/ccxM7oLI.o(.text+0xc4): In function `main':
: undefined reference to `sqlite_exec'
collect2: ld returned 1 exit status
---------------------------------------------------------------
Happy Coding!!!
Warm regards
Ashish Singh
[EMAIL PROTECTED], [EMAIL PROTECTED]
Graduate Student (MS-Software Engineering)
University of Southern California www.cs.usc.edu
Los angeles California USA
323 404 8621(M)
213-746-4142-(R)
Happy Coding!!!
Warm regards
Ashish Singh
[EMAIL PROTECTED], [EMAIL PROTECTED]
Graduate Student (MS-Software Engineering)
University of Southern California www.cs.usc.edu
Los angeles California USA
323 404 8621(M)
213-746-4142-(R)
Happy Coding!!!
Warm regards
Ashish Singh
[EMAIL PROTECTED], [EMAIL PROTECTED]
Graduate Student (MS-Software Engineering)
University of Southern California www.cs.usc.edu
Los angeles California USA
323 404 8621(M)
213-746-4142-(R)