mkdir bld
cd bld
make
make install
检验是否安装成功,我输入了sqlite3myfirst.db
sqlite3> 表示安装成功
int main(int argc,char **argv){
sqlite3 *db;
char *zrrmsg=0;
int rc;
rc=sqlite3_open(argv[1],&db);
if(rc)
{fprintf(stderr,"can't open database:%/n",sqlite3_errmsg(db));
sqlite3_close(db);
exit(1);
}
printf("successfully/n");
sqlite3_close(db);
return 0;
}
sqlite3 *db;
char *zrrmsg=0;
int rc;
rc=sqlite3_open(argv[1],&db);
if(rc)
{fprintf(stderr,"can't open database:%/n",sqlite3_errmsg(db));
sqlite3_close(db);
exit(1);
}
printf("successfully/n");
sqlite3_close(db);
return 0;
}
输入 gcc -o first first.c -lsqlite3
编译没有出现问题,
./first: error while loading shared libraries: libsqlite3.so.0: cannot open shared object file: No such file or directory
我就把/usr/local/lib 中的libsqlite3.* 都拷贝到/usr/lib下,在运行,就ok了,出现了successfully!!
我的第一个sqlite 程序就诞生了!!