Can't use built in SQLite functions after building SQLite plugin in Qt 6.5.1
-
Hi, I need to use built in SQLite hook function. For this purpose i've built SQLite plugin for my prebuilt Qt that I got from online installer. I have tried the following from what Qt docs suggests:
- Downloaded SQLite 3.42.0 source (amalgamation) and windows binaries from offcial site
- Compiled binaries into sqlite3.lib via CMD for VS 2017 with: "lib /DEF:sqlite3.def /OUT:sqlite3.lib /MACHINE:x64"
- configured via Qt 6.5.1 CMD with command: "qt-cmake -G Ninja C:\Qt\6.5.1\Src\qtbase\src\plugins\sqldrivers -DCMAKE_INSTALL_PREFIX=C:\Qt\6.5.1\mingw_64 -DCMAKE_INCLUDE_PATH=C:\libs\sqlite-amalgamation-3420000 -DCMAKE_LIBRARY_PATH=C:\libs\sqlite-amalgamation-3420000 -DFEATURE_system_sqlite=ON". All sqlite3 files (binaries and .c/.h) were in sqlite-amalgamation-3420000 folder.
- cmake --build .
- cmake --install .
- Using sqlite header file in my project tried to call a function which gives me error of undefined reference.
Have I built it wrong way or am I using it incorecctly?
I would appreciate any help. Thanks in advance. -
You can as explained in the documentation but you have to link against the exact same sqlite library and it must not be compiled statically into the plugin but a separate sqlite dll.
-
@ioki9 said in Can't use built in SQLite functions after building SQLite plugin in Qt 6.5.1:
Using sqlite header file in my project tried to call a function which gives me error of undefined reference.
I would not expect anything else since the sqlite functions are in a Qt sql plugin and not exported anywhere.
-
@Christian-Ehrlicher So basically I can't use built in SQLite functions and Qt SQL in the same project?
-
You can as explained in the documentation but you have to link against the exact same sqlite library and it must not be compiled statically into the plugin but a separate sqlite dll.
-
@Christian-Ehrlicher I thought that linking to Qt SQLite was enough after rebuilding plugin and using header. It worked after I linked to the initial library I was building Qt plugin from. Thanks for your help!
-
-
@ioki9 said in Can't use built in SQLite functions after building SQLite plugin in Qt 6.5.1:
I thought that linking to Qt SQLite was enough after rebuilding plugin and using header.
It can't - it does not export the sqlite functions in any way (why should it).