Linux 下的 sqlite3 的安装

 

第一步:下载sqlite源码包,并解压
>wget http://www.sqlite.org/sqlite-3.6.16.tar.gz
>tar -zxvf sqlite-3.6.16.tar.gz
第二步:安装
>./configure -disable-tcl
>make
>make install

第三步:编写代码测试
>vim sqlite_rw.c

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sqlite3.h>

int main(int argc, char **argv)
{
        sqlite3 *db=0;
        int  r= sqlite3_open("test.db",&db);

        if (r)
        {
                printf("can't open test.db\n");
        }else{
                printf("open db ok\n");
        }

        sqlite3_close(db);

        return 0;
}


 

第四步:编译
>gcc sqlite_rw.c -o sqlite_rw -lsqlite3

发布了84 篇原创文章 · 获赞 15 · 访问量 14万+

猜你喜欢

转载自blog.csdn.net/TDGX2004/article/details/7264800