➜ test_sqlite3 gcc *.c -I . -o xixi -pthread
/tmp/cckGKTrr.o: In function `unixDlOpen':
sqlite3.c:(.text+0x1124d): undefined reference to `dlopen'
/tmp/cckGKTrr.o: In function `unixDlError':
sqlite3.c:(.text+0x1126c): undefined reference to `dlerror'
/tmp/cckGKTrr.o: In function `unixDlSym':
sqlite3.c:(.text+0x112bb): undefined reference to `dlsym'
/tmp/cckGKTrr.o: In function `unixDlClose':
sqlite3.c:(.text+0x112f1): undefined reference to `dlclose'
collect2: error: ld returned 1 exit status
在头文件中、加入
#include <dlfcn.h>
编译时,链接
dl库
如图
![](https://i-blog.csdnimg.cn/blog_migrate/ce669ef95f5b86d39ef303d42019f7c0.png)