Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Compiling MYSQL driver with qt error " Qt5Sql.lib(Qt5Sql.dll) : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'"



  • I'm trying to compile or build qt sql drivers to be able to connect to the mysql database.

    I ran the following commands as instructed on the tutorial

    cd %QTDIR%\qtbase\src\plugins\sqldrivers\mysql
    qmake "INCLUDEPATH+=C:/MySQL/include" "LIBS+=C:/MYSQL/MySQL Server <version>/lib/opt/libmysql.lib" mysql.pro
    nmake
    
    

    I am getting this error:

    " Qt5Sql.lib(Qt5Sql.dll) : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'"
    
    

    I did download the 64bit version of the mysql library "mysql-5.7.14-winx64.zip" but i am still getting the same error.

    I even tried to install DB2 and install it but i am still getting the same error.

    Please help me on how to solve this ?



  • The problem is that you are using a 32bit compiler. What compiler and OS are you building in?



  • @VRonin I am using MSVC2015 64 bit on a 64 bit Windows 7.



  • How do you initialise your compiler? you should call vcvarsall.bat amd64 to use the 64bit compiler



  • Thanks @VRonin, i ran vcvarsall.exe amd64 on the MSVC2015 command prompt to configure for x64 build. It compiled successfully.


Log in to reply