未定义对sqlite3_open的引用。我没主意

对不起,这个头衔不好。 我想开始在C ++中使用sqlite。所以我从网站上下载了合并文件,并进行编译以获取.dll。

gcc -shared sqlite3.c -o sqlite3.dll

我在项目中包括了sqlite.h文件,也包括了.dll文件。我编译了:

g++ prueba.cpp

并收到此错误消息

C:\Users\PABLOS~1\AppData\Local\Temp\ccUI3YAt.o:prueba.cpp:(.text+0x2d): undefined reference to `sqlite3_open'
C:\Users\PABLOS~1\AppData\Local\Temp\ccUI3YAt.o:prueba.cpp:(.text+0x41): undefined reference to `sqlite3_errmsg'
collect2.exe: error: ld returned 1 exit status

好吧,我说,让我们看看堆栈溢出。在我读过的一些问题中,他们建议这样做:

g++ main.cpp sqlite3.c

但是输出是一长串错误消息。我继续阅读,但大多数问题的解决方法是:

sudo apt install libsqlite3-dev
or
gcc main.c -lsqlite3

In one of the questions the same guy that asked answered that he didnt include the .a file. So i googled about it and followed the instructions in this article. I created the .def file:

dlltool -z sqlite3.def --export-all-symbols sqlite3.dll

并创建了.a文件

dlltool -d sqlite3.def -l libsqlite3dll.a

然后将其包含在C:\ MinGW \ lib中,然后再次尝试编译

g++ prueba.cpp -lsqlite3dll

而且我得到了相同的错误消息。在这一点上,我有点迷失了(我是编程新手),我不知道下一步该怎么做。您能给我指点我应该前进的方向吗?

编辑:回答问题形式的评论