简体   繁体   中英

c++ sqlite3 pthread error

I'm trying to build sqlite3 on my linux and use it in my c++ code. However, after compiling sqlite3 and including #include <sqlite3.h> I get the following error:

.../main.cpp|52|undefined reference to `sqlite3_open'|

and after adding sqlite3.c and sqlite3.h to my project I get the following error:

.../sqlite3.c|20803|undefined reference to `pthread_mutexattr_init'|

I tried sqlite3 with both following settings:

gcc shell.c sqlite3.c -lpthread -ldl

and

gcc -DSQLITE_THREADSAFE=0 shell.c sqlite3.c -ldl

Do you have any idea where the problem might be or do you know any SQLite3 CPP wrapper?

Thanks,

通过使用-pthread而不是-lpthread解决此问题。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM