gcc编译出现dlopen、dlerror、dlsym、dlcolse的解决方法

 
➜  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库
 
 
如图
 

猜你喜欢

转载自www.cnblogs.com/schips/p/9966206.html
今日推荐