我在构建 sqlite3 合并时遇到了麻烦,就像我以前在 Windows 中那样,通过将源代码直接编译到我的程序中,这是我当前的 makefile
all:
gcc -g -c sqlite3.c -o sqlite3.o
g++ -g -c main.cpp -o main.o
g++ -o test sqlite3.o main.o
我的 main.cpp 文件:
#include "sqlite3.h"
int main(){
//nothing
return 0;
}
这是我在编译时收到的错误:
sqlite.o: In function `pthreadMutexAlloc':
/home/kendal/c++/sqlite3/test/../lib/sqlite3.c:17910: undefined reference to
`pthread_mutexattr_init'
/home/kendal/c++/sqlite3/test/../lib/sqlite3.c:17911: undefined reference to
`pthread_mutexattr_settype'
/home/kendal/c++/sqlite3/test/../lib/sqlite3.c:17913: undefined reference to`pthread_mutexattr_destroy'
sqlite.o: In function
`pthreadMutexTry':
/home/kendal/c++/sqlite3/test/../lib/sqlite3.c:18042: undefined reference to `pthread_mutex_trylock'
sqlite.o: In function `unixDlOpen': /home/kendal/c++/sqlite3/test/../lib/sqlite3.c:28164: undefined reference to `dlopen'
sqlite.o: In function `unixDlError':
/home/kendal/c++/sqlite3/test/../lib/sqlite3.c:28178: undefined reference to `dlerror'
sqlite.o: In function `unixDlSym':
/home/kendal/c++/sqlite3/test/../lib/sqlite3.c:28204: undefined reference to `dlsym'
sqlite.o: In function `unixDlClose':
/home/kendal/c++/sqlite3/test/../lib/sqlite3.c:28209: undefined reference to `dlclose'