Struggling with MySQL driver build

  • I have a 32-bit MSVC application that I would like to use MySQL drive with. I've read through the documentation and at least 20+ forum post regarding this. I am a noob and apologize for my arrogance.

    Currently I have MySQL server and connector libs/include in a folder C:\mysql drive without spaces as recommended. I am using MinGW 64-bit (not sure which version I need).

    I ran:

    1. set mysql=C:\mysqltemp
    2. cd F:\Qt\5.14.0\Src\qtbase\src\plugins\sqldrivers\mysql
    3. qmake "INCLUDEPATH+=C:\MySQL\include" "LIBS+=-LC:\MYSQL\lib\libmysql.lib -lmysql"
    4. ming32-make

    Now I receive an error "x86_64-w64-mingw32/bin/ld.exe: cannot find -lmysql"

    I assume this has something to do with reimp mentioned here:

    Before I go down another rabbit hole since I know nothing about reimp, is this a correct assumtion?

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    First issue, you are mentioning 32MSVC then go on with MinGW 64, so which one is it ?

    Second, what you should get is the MySQL C connector library not the C++.

    Third, unless you are indeed using Qt 4, the command is wrong, please read the Qt 5 instructions matching the Qt version you are currently using.

  • I am not sure can you help me figure out what I need? I have a 32MSVC program but need to build the MySQL driver. In order to do that do I use MinGW 64 to compile? I was not able to find any instructions on how to build for/with MSVC.

    Secondly, wow I did not realize I was using the wrong library palm face.

    Third, I have read Qt 5 instructions and did originally try it with that, but after reading forum posts I switched back.

    I will install the C connector, clean up my build directory, and attempt with Qt 5 instructions. However where would I build this, using MinGW 32 CMD? Because once it is build I just need to bring two DLLs over to my application build directory correct?

  • Lifetime Qt Champion

    No, you have to use the same compiler that was used to build Qt. You can't mix and match C++ librairies built with MinGW and MSVC.