mekkanizer
mekkanizer

Reputation: 741

Qt Dynamically load MySQL driver

I have no experience with deploying apps. I started manually (by copying release.exe to target PC and 1-by-1 resolving it's DLL dependencies). I've ran into "Driver not loaded Driver not loaded" wall and I'm stuck now.
I tried starting anew with the help of windeployqt, it compiled a nice set of files and directories, and still that same error.
I tried checking arch of dlls with notepad hack and tried redownloading libmysql.dll from different places. I have rebuilt qsqlmysql.dll manually (only to learn I really needed libmysql.dll). I added project folder to PATH variable, still to no avail.
I've heard that Dependecy Walker might help, but it didn't, it only warned me that there were errors finding some files, to quote,

Error: At least one required implicit or forwarded dependency was not found.
Warning: At least one delay-load dependency module was not found.
Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.  

So I'm begging for a method to learn where to put the DLL. Or just for a path, regarding that the app, dlls and everithing is 32-bit.

P.S. I've just learned that if I try to statically link that .lib file (which is by the way 30KB in size compared to .dll's 4MB) the build is successful but it changes nothing. DLL still needed

Upvotes: 0

Views: 181

Answers (1)

Mohammad Kanan
Mohammad Kanan

Reputation: 4582

Download the 32bit connector for MySQL from here, then make a dynamic link to the lib, (Project -> Add Library -> External -> Dynamic), tick the platfrom you are working on; something like:

win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../../mysql/mysql-connector-c-6.1.11-win32/lib/ -llibmysql
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../../mysql/mysql-connector-c-6.1.11-win32/lib/ -llibmysqld

INCLUDEPATH += $$PWD/../../../../../mysql/mysql-connector-c-6.1.11-win32/include
DEPENDPATH += $$PWD/../../../../../mysql/mysql-connector-c-6.1.11-win32/include

Upvotes: 1

Related Questions